function WindowManager() {
    this.nextWindowID = 0;
    this.topWinWindowID = 0;
    this.windowHandles = {};
    this.weOpenerWindowIDs = {};
    this.weChildrenWindowIDs = {};
    this.weChildrenNameToWindowID = {};
    this.weWindowModes = {};
    this.weWindowTypes = {};
    this.windowArgs = {};
    this.weChildArrived = {};
    this.processEventIntervalHandles = {};
    this.continuationFuncs = {};
    this.currentWindowIDStack = new Array();
    this.inlineIntervalsStack = [];
    this.inlineFormLoadCounter = 0;
    this.lasttimeCookieUpdated = null;
    this.registerWindow = function(b, g) {
        var f = this.windowHandles["" + b];
        var d = new WindowHandle(b, false, g, null);
        this.windowHandles["" + b] = d
    };
    this.report = function() {
        var d = 0;
        var b = 0;
        for (b in this.windowHandles) {
            this.reportTxt += "WindowID[" + b + "] = " + this.windowHandles[b].windowID + "\n";
            d++
        }
        alert(this.reportTxt);
        this.reportTxt = d + " total windows.\n";
        alert(this.reportTxt)
    };
    this.unregisterWindow = function(d) {
        if (isLogicalWindow(d)) {
            this.unregisterLogicalWindow(d);
            return
        }
        unregisterProcessEventIntervalHandle_NS(d);
        var f = getOpenerWindowID(d);
        if (f != null) {
            var b = f.windowID;
            var g = f.windowObj;
            removeOpenerWindowID(d)
        }
        removeChildWindowIDs(d);
        delete this.windowHandles["" + d];
        fc.unregisterContext(d)
    };
    this.unregisterLogicalWindow = function(b) {
        var f = getLogicalChildWindowIDs(b);
        for (var d in f) {
            this.unregisterLogicalWindow(f[d])
        }
        unregisterProcessEventIntervalHandle_NS(b);
        delete this.windowHandles["" + b];
        fc.unregisterContext(b)
    };
    this.allocWindow = function() {
        return this.nextWindowID++
    };
    this.getTopWinWindowID = function() {
        return this.topWinWindowID
    };
    this.getParentWindowID = function(b) {
        var d = this.windowHandles["" + b];
        return d.parentWindowID
    };
    this.pushCurrentWindowID = function(b) {
        this.currentWindowIDStack.push(b)
    };
    this.popCurrentWindowID = function(b) {
        var f = null;
        if (this.currentWindowIDStack.length > 0) {
            f = this.currentWindowIDStack.pop();
            if (f != b) {
                this.currentWindowIDStack.push(f);
                for (var d = this.currentWindowIDStack.length - 1; d > 0; d--) {
                    if (this.currentWindowIDStack[d] == b) {
                        this.currentWindowIDStack.splice(d, 1);
                        break
                    }
                }
            }
        }
        return (f)
    };
    this.getCurrentWindowID = function() {
        var b = null;
        if (this.currentWindowIDStack.length > 0) {
            b = this.currentWindowIDStack[this.currentWindowIDStack.length - 1]
        }
        return (b)
    };
    this.pushInlineInterval = function(d, b) {
        this.inlineIntervalsStack.push({
            func: d,
            interval: b
        })
    };
    this.popInlineInterval = function() {
        if (this.inlineIntervalsStack.length > 0) {
            return (this.inlineIntervalsStack.pop())
        } else {
            return null
        }
    };
    this.getInlineIntervalsLen = function() {
        return (this.inlineIntervalsStack.length)
    };
    this.getInlineFormLoadCounter = function() {
        return this.inlineFormLoadCounter
    };
    this.incInlineFormLoadCounter = function() {++this.inlineFormLoadCounter
    };
    this.decInlineFormLoadCounter = function() {
        if (this.inlineFormLoadCounter > 0) {--this.inlineFormLoadCounter
        }
    }
}
var wm = new WindowManager();
var resizeWindow = false;
function WindowHandle(b, f, g, d) {
    this.windowID = b;
    this.isDialogue = f;
    this.parentWindowID = g;
    this.children = d;
    this.close = function() {};
    this.cleanup = function() {}
}
function FormContextManager() {
    this.formContexts = {};
    this.Templates = {};
    this.formWorkflows = {};
    this.formDatas = {};
    this.udds = {};
    this.sfvsnippets = {};
    this.sfmap = {};
    this.registerContext = function(f, g, h, b, u, p, k, o, s) {
        var q = this.formContexts["" + f];
        var d = new FormContext(f, g, h, b, u, p, k, o, s);
        this.formContexts["" + f] = d
    };
    this.getContext = function(b) {
        return this.formContexts["" + b]
    };
    this.unregisterContext = function(b) {
        delete this.formContexts["" + b]
    }
}
function getFormContext(b) {
    return fc.getContext(b)
}
function FormContext(d, f, g, b, q, s, h, k, o) {
    this.windowID = d;
    this.weChildren = [];
    this.currentWorkflowCtx = null;
    this.StateMgr = null;
    this.userDataDynamic = f;
    this.server = g;
    this.formName = b;
    this.view = q;
    this.fieldsID = s;
    this.URLParams = (h == null) ? [] : h;
    this.fields = new Array;
    this.FieldListInfo = {};
    this.LayoutParentFields = [];
    this.FieldChanged = 0;
    this.Field_LastCleared = 1;
    this.VUILayoutModel = new FillLayoutPolicy();
    this.ARKWValues = getARKWValuesInstance();
    this.ARKWNameLookup = new Array(this.ARKWValues.length);
    for (var p = 0; p < this.ARKWValues.length; ++p) {
        this.ARKWNameLookup[this.ARKWValues[p].n] = p
    }
    this.TbRefreshIntervals = {};
    this.OpenDIVPopup = null;
    this.CharEditPopups = [];
    this.WFThreadsList = [];
    this.AsyncFields = [];
    this.AsyncPH = [];
    this.IsInInterruptMode = 0;
    this.ARStateCurrent = -1;
    this.TemplateFields = {};
    this.DBSnapshot = null;
    this.ARMenuCache = {};
    this.DiaryFields = [];
    this.ViewFields = [];
    this.ARFieldROBg = "#DEE0E0";
    this.FormPaneMPanes = [];
    this.FormElements = [];
    this.ToolBarPane = null;
    this.FormContainerPane = null;
    this.FormContainerPaneSH = null;
    this.FormContainerPaneSW = null;
    this.SplitterPane = null;
    this.ResultsListPane = null;
    this.PromptBarPane = null;
    this.QBPane = null;
    this.ARProcessEventMIncomingQ = [];
    this.TableFields = [];
    this.currencyCodes = null;
    this.currencyMenu = null;
    this.AttachPoolFields = [];
    this.PageDirty = false;
    this.nextZIndex = 100001;
    this.WDECurrentDrag = null;
    this.qbe = null;
    this.ARInitPane = null;
    this.ARMaps = {};
    this.ARArrays = {};
    this.FormJSHolder = null;
    this.flipper = null;
    this.rightimg = null;
    this.downimg = null;
    this.tbopen = true;
    this.tbmaxheight = 40;
    this.ALInterval = [];
    this.windowName = (typeof o != "undefined" && o != null) ? o: window.name
}
var fc = new FormContextManager;
function getWindowName_NS(b) {
    return getFormContext(b).windowName
}
function setWindowName_NS(b, d) {
    getFormContext(b).windowName = d
}
function getARInitPane_NS(b) {
    return getFormContext(b).ARInitPane
}
function setARInitPane_NS(b, d) {
    return getFormContext(b).ARInitPane = d
}
function getweChildren_NS(b) {
    return getFormContext(b).weChildren
}
function setweChildren_NS(b, d) {
    getFormContext(b).weChildren = d
}
function getWindowMgr_NS() {
    return wm
}
function getSFV_NS(d) {
    var b = getFormContext(d);
    return {
        s: b.server,
        f: b.formName,
        v: b.view
    }
}
function getDefaults_NS(b) {
    return getFormDataHolderById(b).Defaults
}
function getFields_NS(b) {
    return getFormContext(b).fields
}
function getARMaps_NS(b) {
    return getFormContext(b).ARMaps
}
function getARArrays_NS(b) {
    return getFormContext(b).ARArrays
}
function getVUILayoutModel_NS(b) {
    return getFormContext(b).VUILayoutModel
}
function getFieldListInfo_NS(b) {
    return getFormContext(b).FieldListInfo
}
function getFieldChanged_NS(b) {
    return getFormContext(b).FieldChanged
}
function setFieldChanged_NS(b, d) {
    getFormContext(b).FieldChanged = d
}
function getField_LastCleared_NS(b) {
    return getFormContext(b).Field_LastCleared
}
function setField_LastCleared_NS(b, d) {
    getFormContext(b).Field_LastCleared = d
}
function getARKWNameLookup_NS(b) {
    return getFormContext(b).ARKWNameLookup
}
function getCurWFC_NS(b) {
    var d = getFormContext(b);
    if (typeof d == "undefined" || d == null) {
        return null
    }
    return d.currentWorkflowCtx
}
function setCurWFC_NS(b, d) {
    getFormContext(b).currentWorkflowCtx = d
}
function getForm_NS(b) {
    return getFormDataHolderById(b).Form
}
function getTbRefreshIntervals_NS(b) {
    return getFormContext(b).TbRefreshIntervals
}
function getOpenDIVPopup_NS(b) {
    return getFormContext(b).OpenDIVPopup
}
function setOpenDIVPopup_NS(b, d) {
    getFormContext(b).OpenDIVPopup = d
}
function getCharEditPopups_NS(b) {
    return getFormContext(b).CharEditPopups
}
function getWFThreadsList_NS(b) {
    return getFormContext(b).WFThreadsList
}
function getAsyncFields_NS(b) {
    return getFormContext(b).AsyncFields
}
function getAsyncPH_NS(b) {
    return getFormContext(b).AsyncPH
}
function getIsInInterruptMode_NS(b) {
    return getFormContext(b).IsInInterruptMode
}
function setIsInInterruptMode_NS(b, d) {
    getFormContext(b).IsInInterruptMode = d
}
function getStateMgr_NS(b) {
    return getFormContext(b).StateMgr
}
function setStateMgr_NS(b, d) {
    getFormContext(b).StateMgr = d
}
function getARStateCurrent_NS(b) {
    return getFormContext(b).ARStateCurrent
}
function setARStateCurrent_NS(b, d) {
    getFormContext(b).ARStateCurrent = d
}
function getuserSearches_NS(b) {
    return getUDDHolderById(b).userSearches
}
function gettablePrefs_NS(b) {
    return getUDDHolderById(b).tablePrefs
}
function getmaxQuickReportSize_NS(b) {
    return getUDDHolderById(b).maxQuickReportSize
}
function getquickReportsExisting_NS(b) {
    return getUDDHolderById(b).quickReportsExisting
}
function getcurQuickReportSize_NS(b) {
    return getUDDHolderById(b).curQuickReportSize
}
function getsysMsgPromptType_NS(b) {
    return getUDDHolderById(b).sysMsgPromptType
}
function getQBE_NS(b) {
    return getUDDHolderById(b).qbe
}
function getTemplateFields_NS(b) {
    return getFormContext(b).TemplateFields
}
function getDBSnapshot_NS(b) {
    return getFormContext(b).DBSnapshot
}
function setDBSnapshot_NS(b, d) {
    getFormContext(b).DBSnapshot = d
}
function getARMenuCache_NS(b) {
    return getFormContext(b).ARMenuCache
}
function getDiaryFields_NS(b) {
    return getFormContext(b).DiaryFields
}
function getViewFields_NS(b) {
    return getFormContext(b).ViewFields
}
function getARFieldROBg_NS(b) {
    return getFormContext(b).ARFieldROBg
}
function setARFieldROBg_NS(b, d) {
    getFormContext(b).ARFieldROBg = d
}
function getFormPaneMPanes_NS(b) {
    return getFormContext(b).FormPaneMPanes
}
function getFormElements_NS(b) {
    return getFormContext(b).FormElements
}
function getToolBarPane_NS(b) {
    return getFormContext(b).ToolBarPane
}
function setToolBarPane_NS(b, d) {
    getFormContext(b).ToolBarPane = d
}
function getFormContainerPane_NS(b) {
    return getFormContext(b).FormContainerPane
}
function setFormContainerPane_NS(b, d) {
    getFormContext(b).FormContainerPane = d
}
function getFormContainerPaneSH_NS(b) {
    return getFormContext(b).FormContainerPaneSH
}
function setFormContainerPaneSH_NS(b, d) {
    getFormContext(b).FormContainerPaneSH = d
}
function getFormContainerPaneSW_NS(b) {
    return getFormContext(b).FormContainerPaneSW
}
function setFormContainerPaneSW_NS(b, d) {
    getFormContext(b).FormContainerPaneSW = d
}
function getSplitterPane_NS(b) {
    return getFormContext(b).SplitterPane
}
function setSplitterPane_NS(b, d) {
    getFormContext(b).SplitterPane = d
}
function getResultsListPane_NS(b) {
    return getFormContext(b).ResultsListPane
}
function setResultsListPane_NS(b, d) {
    getFormContext(b).ResultsListPane = d
}
function getPromptBarPane_NS(b) {
    return getFormContext(b).PromptBarPane
}
function setPromptBarPane_NS(b, d) {
    getFormContext(b).PromptBarPane = d
}
function getQBPane_NS(b) {
    return getFormContext(b).QBPane
}
function setQBPane_NS(b, d) {
    getFormContext(b).QBPane = d
}
function getLayoutParentFields_NS(b) {
    return getFormContext(b).LayoutParentFields
}
function getARKeywords_NS(b) {
    return getFormDataHolderById(b).ARKeywords
}
function getARKWValues_NS(b) {
    return getFormContext(b).ARKWValues
}
function getARProcessEventMIncomingQ_NS(b) {
    if (typeof getFormContext(b) == "undefined") {
        return undefined
    }
    return getFormContext(b).ARProcessEventMIncomingQ
}
function registerProcessEventIntervalHandle_NS(b, d) {
    getWindowMgr_NS().processEventIntervalHandles["" + b] = d
}
function unregisterProcessEventIntervalHandle_NS(b) {
    var d = getWindowMgr_NS().processEventIntervalHandles["" + b];
    if (typeof d == "undefined") {
        return
    }
    delete getWindowMgr_NS().processEventIntervalHandles["" + b];
    clearInterval(d)
}
function getTableFields_NS(b) {
    return getFormContext(b).TableFields
}
function getTemplates_NS() {
    return fc.Templates
}
function getcurrencyCodes_NS(b) {
    return currencyCodes
}
function getcurrencyMenu_NS(b) {
    return currencyMenu
}
function getcurrencyFieldMenu(d, b) {
    return getFormContext(d).fields[b].mMenuDef
}
function getDiaryHistory(d, b) {
    var f = getFormContext(d).fields[b].GetHistory();
    return f
}
function showDiaryHistory(d, b) {
    var f = false;
    if (getFormContext(d).ARStateCurrent != 1 && getFormContext(d).ARStateCurrent != 4) {
        f = true
    }
    return f
}
function getStatusEnumInfo_NS(b) {
    return getFormDataHolderById(b).StatusEnumInfo
}
function getARMenus_NS(b) {
    return getFormDataHolderById(b).ARMenus
}
function getGInfo_NS(b) {
    return getFormDataHolderById(b).GInfo
}
function getARTitles_NS(b) {
    return getFormDataHolderById(b).ARTitles
}
function getAttachPoolFields_NS(b) {
    return getFormContext(b).AttachPoolFields
}
function getPageDirty_NS(b) {
    return getFormContext(b).PageDirty
}
function setPageDirty_NS(b, d) {
    getFormContext(b).PageDirty = d
}
function getnextZIndex_NS(b) {
    return getFormContext(b).nextZIndex
}
function setnextZIndex_NS(b, d) {
    getFormContext(b).nextZIndex = d
}
function getWDECurrentDrag_NS(b) {
    return getFormContext(b).WDECurrentDrag
}
function setWDECurrentDrag_NS(b, d) {
    getFormContext(b).WDECurrentDrag = d
}
function getFormJSHolder_NS(b) {
    return getFormContext(b).FormJSHolder
}
function setFormJSHolder_NS(b, d) {
    getFormContext(b).FormJSHolder = d
}
function getflipper_NS(b) {
    return getFormContext(b).flipper
}
function setflipper_NS(b, d) {
    getFormContext(b).flipper = d
}
function getrightimg_NS(b) {
    return getFormContext(b).rightimg
}
function setrightimg_NS(d, b) {
    getFormContext(d).rightimg = b
}
function getdownimg_NS(b) {
    return getFormContext(b).downimg
}
function setdownimg_NS(b, d) {
    getFormContext(b).downimg = d
}
function gettbopen_NS(b) {
    return getFormContext(b).tbopen
}
function settbopen_NS(b, d) {
    getFormContext(b).tbopen = d
}
function gettbmaxheight_NS(b) {
    return getFormContext(b).tbmaxheight
}
function settbmaxheight_NS(d, b) {
    getFormContext(d).tbmaxheight = b
}
function getWindowArgs_NS(b) {
    return getWindowMgr_NS().windowArgs["" + b]
}
function rmWindowArgs_NS(b) {
    if (typeof wm.windowArgs["" + b] != "undefined") {
        delete wm.windowArgs["" + b]
    }
}
function setWindowArgs_NS(b, d) {
    getWindowMgr_NS().windowArgs["" + b] = d
}
function getChildArrived_NS(b) {
    return getWindowMgr_NS().weChildArrived["" + b]
}
function setChildArrived_NS(b, d) {
    getWindowMgr_NS().weChildArrived["" + b] = d
}
function removeChildArrived_NS(b) {
    if (typeof wm.weChildArrived["" + b] != "undefined") {
        delete wm.weChildArrived["" + b]
    }
}
function allocWindowID_NS() {
    return getWindowMgr_NS().allocWindow()
}
function getTopWinWindowID_NS() {
    return getWindowMgr_NS().getTopWinWindowID()
}
function getParentWindowID_NS(b) {
    return getWindowMgr_NS().getParentWindowID(b)
}
function getcontinuationFuncs_NS(b) {
    return getWindowMgr_NS().continuationFuncs["" + b]
}
function setcontinuationFuncs_NS(b, d) {
    getWindowMgr_NS().continuationFuncs["" + b] = d
}
function pushCurrentWindowID_NS(b) {
    getWindowMgr_NS().pushCurrentWindowID(b)
}
function popCurrentWindowID_NS() {
    return (getWindowMgr_NS().popCurrentWindowID())
}
function getCurrentWindowID_NS() {
    return (getWindowMgr_NS().getCurrentWindowID())
}
function getOpenerWindowID(b) {
    var d = getWindowMgr_NS().weOpenerWindowIDs["" + b];
    if (typeof d == "undefined") {
        return null
    }
    return d
}
function setOpenerWindowID(b, d, f) {
    getWindowMgr_NS().weOpenerWindowIDs["" + b] = {
        windowID: "" + d,
        windowObj: f
    }
}
function removeOpenerWindowID(b) {
    if (typeof wm.weOpenerWindowIDs["" + b] != "undefined") {
        delete wm.weOpenerWindowIDs["" + b]
    }
}
function genAllLogicalChildWindowIDsInList(d, b) {
    var g = getLogicalChildWindowIDs(d);
    if (g != null && g.length > 0) {
        b.concat(g);
        for (var f in g) {
            genAllLogicalChildWindowIDsInList(g[f], b)
        }
    }
}
function getLogicalChildWindowIDs(b) {
    var o = [];
    var d = getFormContext(b);
    if (typeof d == "undefined") {
        return o
    }
    var k = new Object();
    var h = getViewFields_NS(b);
    for (var f in h) {
        var g = null;
        if (h[f].isInlineForm()) {
            g = h[f].mChildWindowID
        }
        if ((g != null) && (("" + g in k) == false)) {
            k["" + g] = g
        }
    }
    for (var g in k) {
        o.push(k[g])
    }
    return o
}
function isLogicalWindow(b) {
    var g = wm.windowHandles["" + b];
    if (typeof g == "undefined" || g == null) {
        return false
    }
    if (g.parentWindowID == null) {
        return false
    }
    var f = getLogicalChildWindowIDs(g.parentWindowID);
    for (var d in f) {
        if (f[d] == b) {
            return true
        }
    }
    return false
}
function getLogicalWindow(d) {
    var g = wm.windowHandles["" + d];
    if (typeof g == "undefined" || g == null) {
        return null
    }
    if (g.parentWindowID == null) {
        return null
    }
    var b = getViewFields_NS(g.parentWindowID);
    for (var f in b) {
        if (b[f] != null && b[f].isInlineForm() && b[f].mChildWindowID != null && b[f].mChildWindowID == d) {
            return b[f]
        }
    }
    return null
}
function getChildWindowIDs(b) {
    var d = getWindowMgr_NS().weChildrenWindowIDs["" + b];
    if (typeof d == "undefined") {
        return null
    }
    return d
}
function addChildWindowID(d, f, h) {
    var k = getWindowMgr_NS().weChildrenWindowIDs["" + d];
    if (typeof k == "undefined") {
        k = [];
        getWindowMgr_NS().weChildrenWindowIDs["" + d] = k
    }
    var b = k.length;
    for (var g = 0; g < b; g++) {}
    k.push({
        windowID: "" + f,
        windowObj: h
    })
}
function updateChildWindowID(d, f, h) {
    var k = getWindowMgr_NS().weChildrenWindowIDs["" + d];
    var b = k.length;
    for (var g = 0; g < b; g++) {
        if (f == k[g].windowID) {
            k[g].windowObj = h;
            break
        }
    }
}
function getChildWindowIDFromName(b) {
    return (getWindowMgr_NS().weChildrenNameToWindowID["" + b])
}
function setChildWindowIDForName(b, d) {
    getWindowMgr_NS().weChildrenNameToWindowID["" + b] = d
}
function removeChildWindowID(f, g) {
    removeWindowMode(g);
    removeWindowType(g);
    rmWindowArgs_NS(g);
    for (var d in wm.weChildrenNameToWindowID) {
        if (wm.weChildrenNameToWindowID[d] == g) {
            delete wm.weChildrenNameToWindowID[d];
            break
        }
    }
    removeOpenerWindowID(g);
    removeChildArrived_NS(g);
    var k = wm.weChildrenWindowIDs["" + f];
    if (typeof k == "undefined") {
        return
    }
    var b = k.length;
    for (var h = 0; h < b; h++) {
        if (k[h].windowID == g) {
            k.splice(h, 1);
            break
        }
    }
}
function removeChildWindowIDs(b) {
    delete getWindowMgr_NS().weChildrenWindowIDs["" + b]
}
function getWindowType(b) {
    var d = getWindowMgr_NS().weWindowTypes["" + b];
    if (typeof d == "undefined") {
        return ""
    }
    return d
}
function setWindowType(b, d) {
    getWindowMgr_NS().weWindowTypes["" + b] = d
}
function removeWindowType(b) {
    if (typeof wm.weWindowTypes["" + b] != "undefined") {
        delete wm.weWindowTypes["" + b]
    }
}
function getWindowMode(b) {
    var d = getWindowMgr_NS().weWindowModes["" + b];
    if (typeof d == "undefined") {
        return ""
    }
    return d
}
function setWindowMode(b, d) {
    getWindowMgr_NS().weWindowModes["" + b] = d
}
function removeWindowMode(b) {
    if (typeof wm.weWindowModes["" + b] != "undefined") {
        delete wm.weWindowModes["" + b]
    }
}
function hookChildrenToOpener(h) {
    var u = getChildWindowIDs(h);
    if (u == null) {
        return
    }
    var d = u.length;
    var g = getOpenerWindowID(h);
    if ((g == null) && (typeof window.weOpener != "undefined") && (window.weOpener)) {
        g = {
            windowID: "" + getTopWinWindowID_NS(),
            windowObj: window.weOpener
        }
    }
    if (g == null) {
        for (var p = d - 1; p >= 0; --p) {
            var f = u[p].windowID;
            var o = u[p].windowObj;
            if ((o.closed) || (getWindowType(f) == "URL")) {
                removeChildWindowID(h, f);
                continue
            }
            if (typeof o.removeOpenerWindowID != "undefined") {
                o.removeOpenerWindowID(getTopWinWindowID_NS())
            }
            if (typeof o.weOpener != "undefined") {
                o.weOpener = null
            }
            removeChildWindowID(h, f)
        }
        return
    }
    var k = g.windowID;
    var b = g.windowObj;
    for (var p = d - 1; p >= 0; --p) {
        var f = u[p].windowID;
        var o = u[p].windowObj;
        if ((o.closed) || (getWindowType(f) == "URL")) {
            removeChildWindowID(h, f);
            continue
        }
        if (typeof o.getOpenerWindowID != "undefined") {
            if (o.getOpenerWindowID(getTopWinWindowID_NS()) != null) {
                o.setOpenerWindowID(getTopWinWindowID_NS(), k, b)
            }
        }
        if (typeof o.weOpener != "undefined") {
            o.weOpener = b
        }
        var s = b.allocWindowID_NS();
        b.setWindowMode(s, getWindowMode(f));
        b.setWindowType(s, getWindowType(f));
        var v = getWindowArgs_NS(f);
        if (typeof v != "undefined") {
            b.setWindowArgs_NS(s, getWindowArgs_NS(f))
        } else {
            b.setWindowArgs_NS(s, null)
        }
        b.setChildWindowIDForName(o.name, s);
        b.setOpenerWindowID(s, k, b);
        var q = getChildArrived_NS(f);
        if (typeof q != "undefined") {
            b.setChildArrived_NS(s, q)
        }
        b.addChildWindowID(k, s, o);
        removeChildWindowID(h, f)
    }
}
function getChildWindowIDsRecursive(d) {
    var p = [];
    var o = getChildWindowIDs(d);
    if (o == null) {
        return null
    }
    p = p.concat(o);
    var g = o.length;
    for (var f = 0; f < g; f++) {
        var k = o[f].windowID;
        var b = o[f].windowObj;
        var h = b.getChildWindowIDsRecursive(k);
        if (h != null) {
            p = p.concat(h)
        }
    }
    return p
}
function getTopLevelBrowserWindow() {
    var b = window;
    var d = b;
    while (d) {
        d = b.parent;
        if (d != null && !d.closed && d != b) {
            if (! ("ARSystemInit" in d)) {
                break
            }
            b = d
        } else {
            break
        }
    }
    return b
}
function getSameWindowRootWindowID(b) {
    var f = getOpenerWindowID(b);
    if (f == null) {
        return null
    }
    var d = f.windowID;
    var h = f.windowObj;
    if (h != window) {
        return null
    }
    var g = getSameWindowRootWindowID(d);
    if (g == null) {
        return d
    } else {
        return g
    }
}
function getTopLevelWindowIDs() {
    var g = {};
    var f = [];
    for (var b in getWindowMgr_NS().windowHandles) {
        var d = getSameWindowRootWindowID(b);
        if (d == null) {
            d = b
        }
        if (d in g) {
            continue
        }
        f.push({
            windowID: d,
            windowObj: window
        });
        g[d] = d
    }
    return f
}
function getTopLevelBrowserWindowIDs() {
    var b = getTopLevelBrowserWindow();
    return b.getTopLevelWindowIDs()
}
function getAllWindowIDs() {
    var g = [];
    var d = window;
    var f = d;
    while (f) {
        for (var b in f.getWindowMgr_NS().windowHandles) {
            g.push({
                windowID: b,
                windowObj: f
            })
        }
        f = d.parent;
        if (f != null && !f.closed && f != d) {
            if (! ("ARSystemInit" in f)) {
                break
            }
            d = f
        } else {
            break
        }
    }
    return g
}
function getFormWorkflowHolder(f, d, b) {
    var g = (f + "_" + d + "_" + b);
    return fc.formWorkflows[g]
}
function getFormWorkflowHolderById(b) {
    var d = getFormContext(b);
    var f = (d.server + "_" + d.formName + "_" + d.view);
    return fc.formWorkflows[f]
}
function setFormWorkflowHolder(f, d, b, h) {
    var g = (f + "_" + d + "_" + b);
    if (getFormWorkflowHolder(f, d, b) == null) {
        fc.formWorkflows[g] = h
    }
}
function getFormDataHolder(f, d, b) {
    var g = (f + "_" + d + "_" + b);
    return fc.formDatas[g]
}
function getFormDataHolderById(b) {
    var d = getFormContext(b);
    var f = (d.server + "_" + d.formName + "_" + d.view);
    return fc.formDatas[f]
}
function setFormDataHolder(f, d, b, h) {
    var g = (f + "_" + d + "_" + b);
    if (getFormDataHolder(f, d, b) == null) {
        fc.formDatas[g] = h
    }
}
function getUDDHolder(f, d, b) {
    var g = (f + "_" + d + "_" + b);
    return fc.udds[g]
}
function getUDDHolderById(b) {
    var d = getFormContext(b);
    var f = (d.server + "_" + d.formName + "_" + d.view);
    return fc.udds[f]
}
function setUDDHolder(f, d, b, h) {
    var g = (f + "_" + d + "_" + b);
    if (getUDDHolder(f, d, b) == null) {
        fc.udds[g] = h
    }
}
function setSFVSnippet(g, f, b, d) {
    var h = (g + "_" + f + "_" + b);
    fc.sfvsnippets[h] = d
}
function getSFVSnippet(f, d, b) {
    return fc.sfvsnippets[(f + "_" + d + "_" + b)]
}
function setSFMap(g, f, b) {
    var d = (g + "_" + f);
    var h = (g + "_" + f + "_" + b);
    fc.sfmap[d] = h
}
function getSFMap(d, b) {
    return fc.sfmap[(d + "_" + b)]
}
function getSFVSnippetFromSF(f, b) {
    var d = getSFMap(f, b);
    if (d != null) {
        return fc.sfvsnippets[d]
    }
    return null
}
function ARRunGotoX(g, b, d) {
    var f = [b, d, 0];
    if (getCurWFC_NS(b).getGuideState() != null) {
        new WorkflowContext(b, {
            t: g,
            f: ARRunGoto,
            a: f,
            e: ARRunGotoException,
            ea: f
        })
    } else {
        return {
            n: {
                t: g,
                f: ARRunGoto,
                a: f,
                e: ARRunGotoException,
                ea: f
            }
        }
    }
}
function ARRunGoto(b, d, g) {
    while (g < d.length) {
        var h = getCurWFC_NS(b).execute({
            f: d[g + 1],
            a: [b]
        });
        if (h) {
            var f = [b, d, g + 2];
            return {
                i: 1,
                n: {
                    f: ARRunGoto,
                    a: f,
                    e: ARRunGotoException,
                    ea: f
                }
            }
        }
        g += 2
    }
}
function ARRunGotoException(h, b, d, g) {
    if (typeof h != "object" || !(h instanceof WorkflowException)) {
        throw h
    }
    if (h.getCode() == 1) {
        var k = h.getNumValue();
        while ((g > 0 && k < d[g]) || g >= d.length) {
            g -= 2
        }
        while (g < d.length && k > d[g]) {
            g += 2
        }
        if (g < d.length) {
            var f = [b, d, g];
            return {
                n: {
                    f: ARRunGoto,
                    a: f,
                    e: ARRunGotoException,
                    ea: f
                }
            }
        }
    } else {
        throw h
    }
}
function ARRunX(k, d, g) {
    var f = [];
    var b = g.length;
    for (var h = b - 1; h >= 0; h--) {
        f.push({
            t: k,
            f: g[h],
            a: [d]
        })
    }
    return getCurWFC_NS(d).executeAll(f)
}
function ARGotoGuideLabel(b, g) {
    var f = getCurWFC_NS(b).getGuideState();
    if (f != null) {
        var d = f.f;
        var h;
        for (h = 0; h < d.length; ++h) {
            if (typeof d[h] == "string" && d[h] == g) {
                f.i = h;
                throw new WorkflowException(b, 2, g)
            }
        }
    }
}
function ARRunGuideX(g, b, f) {
    var d = getCurWFC_NS(b).getGuideState();
    d.f = f;
    d.i = 0;
    return {
        c: {
            f: ARRunGuide,
            a: [b],
            e: ARRunGuideException,
            ea: [b]
        }
    }
}
function ARRunGuide(b) {
    var f = getCurWFC_NS(b).getGuideState();
    var h = getFormWorkflowHolder(getFormContext(b).server, getFormContext(b).formName, getFormContext(b).view);
    while (f.i < f.f.length) {
        var d = f.f[f.i++];
        if (typeof d == "function") {
            var g = getCurWFC_NS(b).execute({
                t: h,
                f: d,
                a: [b]
            });
            if (g) {
                return {
                    i: 1,
                    n: {
                        f: ARRunGuide,
                        a: [b],
                        e: ARRunGuideException,
                        ea: [b]
                    }
                }
            }
        }
    }
}
function ARRunGuideException(d, b) {
    if (typeof d != "object" || !(d instanceof WorkflowException)) {
        throw d
    }
    switch (d.mCode) {
    case 2:
        return {
            n:
            {
                f:
                ARRunGuide,
                a: [b],
                e: ARRunGuideException,
                ea: [b]
            }
        };
    case 1:
        return {
            n:
            {
                f:
                ARRunGuide,
                a: [b],
                e: ARRunGuideException,
                ea: [b]
            }
        };
    default:
        throw d
    }
}
function CallIf(f, g) {
    if (!f) {
        return
    }
    var b = new Array(arguments.length - 2);
    for (var d = 0; d < arguments.length - 2; ++d) {
        b[d] = arguments[d + 2]
    }
    return g.apply(null, b)
}
function External(b, d) {
    var f = F(b, d).G().toString().trim(1 | 2);
    if (f == "") {
        return true
    }
    f = ExpandString(b, f, 2 | 4 | 8);
    req = new NDXCompileQualification(b, ARKWGetStringByIdx(b, 7), ARKWGetStringByIdx(b, 6), ARKWGetStringByIdx(b, 17), f);
    return req.result
}
var WorkflowEventMap = {
    0 : {
        f: "AREVTNone"
    },
    1 : {
        f: "AREVTButton",
        id: true
    },
    2 : {
        f: "AREVTReturn",
        id: true
    },
    4 : {
        f: "AREVTSubmit"
    },
    8 : {
        f: "AREVTModify"
    },
    16 : {
        f: "AREVTDisplay"
    },
    32 : {
        f: "AREVTModifyAll"
    },
    64 : {
        f: "AREVTMenuOpen",
        id: true
    },
    128 : {
        f: "AREVTMenuChoice",
        id: true
    },
    256 : {
        f: "AREVTLoseFocus",
        id: true
    },
    512 : {
        f: "AREVTSetDefault"
    },
    1024 : {
        f: "AREVTQuery"
    },
    2048 : {
        f: "AREVTAfterModify"
    },
    4096 : {
        f: "AREVTAfterSubmit"
    },
    8192 : {
        f: "AREVTGainFocus",
        id: true
    },
    16384 : {
        f: "AREVTWindowOpen"
    },
    32768 : {
        f: "AREVTWindowClose"
    },
    65536 : {
        f: "AREVTUndisplay"
    },
    131072 : {
        f: "AREVTCopySubmit"
    },
    262144 : {
        f: "AREVTWindowLoaded"
    },
    524288 : {
        f: "AREVTInterval",
        id: true
    },
    1048576 : {
        f: "AREVTEvent"
    },
    2097152 : {
        f: "AREVTTableContentChange",
        id: true
    },
    4194304 : {
        f: "AREVTHoverLabel",
        id: true
    },
    8388608 : {
        f: "AREVTHoverData",
        id: true
    },
    16777216 : {
        f: "AREVTHoverField",
        id: true
    },
    33554432 : {
        f: "AREVTPageExpand",
        id: true
    },
    67108864 : {
        f: "AREVTPageCollapse",
        id: true
    },
    134217728 : {
        f: "AREVTDrag",
        id: true
    },
    268435456 : {
        f: "AREVTDrop",
        id: true
    }
};
function AREventFunction(d, g, o) {
    if (g in WorkflowEventMap) {
        var b = WorkflowEventMap[g];
        var k = b.f;
        if (b.id && typeof o != "undefined") {
            k = k + o
        }
        var h = getFormContext(d);
        var f = getFormWorkflowHolder(h.server, h.formName, h.view);
        if (k in f) {
            return {
                h: f,
                f: f[k]
            }
        }
    }
    return null
}
function ARRegisterInterval(b, f, d) {
    if (isLogicalWindow(b)) {
        wm.pushInlineInterval(function() {
            promptBar.setToClear();
            var g = getFormWorkflowHolderById(b);
            new WorkflowContext(b, {
                t: g,
                f: f,
                a: [b]
            })
        },
        d * 1000)
    } else {
        setInterval(function() {
            promptBar.setToClear();
            var g = getFormWorkflowHolderById(b);
            new WorkflowContext(b, {
                t: g,
                f: f,
                a: [b]
            })
        },
        d * 1000)
    }
}
function ExpandServerName(b, d) {
    d = ExpandString(b, d, 1 | 2 | 4);
    if (d == "@") {
        d = ARKWGetStringByIdx(b, 7)
    }
    return d
}
function ExpandSchemaName(b, d) {
    d = ExpandString(b, d, 1 | 2 | 4);
    if (d == "@") {
        d = ARKWGetStringByIdx(b, 6)
    }
    return d
}
function ExpandGuideName(d, b) {
    return ExpandString(d, b, 1 | 2 | 4)
}
function ExpandQualifier(g, p, k, h, q) {
    if ("extids" in p) {
        do {
            var d = new Array();
            var f = new Array();
            var b = new Array();
            var s = new FieldList(g, p.extids);
            s.ToArrays(d, f, b);
            if (typeof q == "undefined") {
                q = false
            }
            if (q) {
                p.fieldids = d;
                p.fieldvals = f;
                p.fieldtypes = b;
                p.fieldexterns = new Array();
                for (var o = 0; o < p.fieldids.length; o++) {
                    p.fieldexterns.push(true)
                }
                break
            } else {
                req = new NDXCompileExternalQualification(g, ARKWGetStringByIdx(g, 7), ARKWGetStringByIdx(g, 6), ARKWGetStringByIdx(g, 17), h, k, p.qual, d, f, b);
                p = req.result
            }
        } while ("extids" in p )
    }
    if (typeof p.fieldids == "undefined" || p.fieldids == null) {
        p.fieldids = new Array();
        p.fieldvals = new Array();
        p.fieldtypes = new Array();
        p.fieldexterns = new Array()
    }
    if ("ids" in p) {
        var s = new FieldList(g, p.ids);
        s.ToArrays(p.fieldids, p.fieldvals, p.fieldtypes);
        for (var o = 0; o < p.ids.length; o++) {
            p.fieldexterns.push(false)
        }
    }
    return p
}
function containsExternal(b) {
    return b.toLowerCase().indexOf("external") != -1
}
var REGEXPREF = /\$.*\$/;
function containsRef(b) {
    return b.match(REGEXPREF) != null;
    return b.toLowerCase().indexOf("$") != -1
}
function IsExternQualOptimizable(g, o) {
    if (! ("extids" in o)) {
        return false
    }
    var p = false;
    var q = false;
    var s = new FieldList(g, o.extids);
    var d = new Array();
    var f = new Array();
    var b = new Array();
    s.ToArrays(d, f, b);
    for (var k in f) {
        var h = f[k];
        if (containsExternal(h)) {
            p = true
        } else {
            if (containsRef(h)) {
                q = true
            }
        }
    }
    return ! p && !q
}
function ExpandKeyword(f, d, g, k, h, p) {
    var s = null;
    var u = null;
    var v = /^-{0,2}[0-9]+$/;
    var o = v.exec(d);
    if (o != null) {
        if (o[0] > 0) {
            return s
        }
        if (o[0] == "--1") {
            return ""
        }
        u = -o[0] + 1;
        if (!ARKWIsKeywordIdx(f, u)) {
            return s
        }
        s = "$" + ARKWGetNameByIdx(f, u) + "$"
    } else {
        if (ARKWIsKeywordName(f, d)) {
            u = ARKWGetKeywordIdx(f, d)
        }
        if (u == null || isNaN(u) || !ARKWIsKeywordIdx(f, u)) {
            return s
        }
    }
    var q = ARKWIsTemporal(f, u);
    if (((g & 2) && !ARKWIsTimeRelated(f, u) && !q) || ((g & 4) && q) || ((g & 16) && ARKwIsConstant(f, u))) {
        if (p) {
            p.hasKeyword = true;
            if (q) {
                p.hasTemporalKeyword = true
            }
        }
        var b = ARKWGetByIdx(f, u, k);
        if (ARKWIsTimeRelated(f, u)) {
            switch (h) {
            case 13:
                b = b.toDate();
                break;
            case 7:
                b = b.toTime();
                break;
            case 14:
                b = b.toTOD();
                break;
            case 3:
                b = b.toReal();
                break;
            case 10:
                b = b.toDecimal();
                break;
            case 2:
                b = b.toInteger();
                break
            }
        }
        s = b.toString()
    }
    return s
}
function ExpandFieldReference(f, d, g, v) {
    var u = null;
    var p = parseInt(d);
    var s = (isNaN(parseInt(d))) ? Field_FindByDBN(f, d) : F(f, d);
    var k = [];
    if (s == null || s == DummyField) {
        var o = 0;
        var q = -2;
        while (o < 2) {
            q = d.lastIndexOf(".");
            if (q < 1) {
                break
            }
            k[o++] = d.substring(q + 1, d.length) + "";
            d = d.substring(0, q);
            s = (isNaN(parseInt(d))) ? Field_FindByDBN(f, d) : F(f, d);
            if (s != null && s.mID != 0) {
                break
            }
        }
    }
    if (s != null && s != DummyField) {
        var b = s.G();
        if (s.mIsComplexField && k.length > 0) {
            var h = b.compound(k);
            if (h != null) {
                u = h.toString()
            }
        } else {
            if (typeof v != "undefined" && v in DatatypeFactories) {
                if (!b.isNull) {
                    u = DatatypeFactories[v](b)
                } else {
                    u = DatatypeFactories[0](b)
                }
                u = u.toString()
            } else {
                u = b.toString()
            }
        }
    } else {
        if (s != null && s == DummyField && s.mObj != null) {
            b = s.mObj.v;
            if (b != null) {
                if (typeof v != "undefined" && v in DatatypeFactories) {
                    if (!b.isNull) {
                        u = DatatypeFactories[v](b)
                    } else {
                        u = DatatypeFactories[0](b)
                    }
                    u = u.toString()
                } else {
                    u = b.toString()
                }
            }
        }
    }
    return u
}
function ExpandStringInDollar(f, s, g, p, o, q) {
    var A = "";
    var y = previousExpand = sentinel = 0;
    var b = end = 0;
    var w = eQuote = needQuote = false;
    var u = "$";
    var h = s.split(u);
    for (var k = 0; k < h.length; ++k) {
        var d = h[k];
        if (d == "" || (k == (h.length - 1))) {
            if (y || (sentinel && !previousExpand)) {
                A += u
            }
            if (k == (h.length - 1)) {
                A += d
            }
            y = 1;
            previousExpand = 0;
            continue
        }
        sentinel = 1;
        if (k > 0 && !previousExpand) {
            var v;
            if ((g & 2) || (g & 4)) {
                if (! (h.length == 3 && h[0] == "" && h[2] == "")) {
                    o = 4
                }
                v = ExpandKeyword(f, d, g, p, o, q)
            }
            if (v == null && (g & 1)) {
                v = ExpandFieldReference(f, d, g)
            }
            if (v != null) {
                d = v;
                previousExpand = 1
            } else {
                if (h.length > 1) {
                    A += u
                }
            }
        } else {
            previousExpand = 0
        }
        y = 0;
        A += d
    }
    return A
}
function ExpandPart(g, d, f) {
    var o = "$";
    var h = f;
    var s = 0;
    var q = d.indexOf(o);
    var u = -1;
    var k = "";
    while (q != -1) {
        k += d.substring(s, q);
        u = d.indexOf(o, q + 1);
        if (u >= 0) {
            var b = d.substring(q + 1, u);
            var p = null;
            if ((h & 2) || (h & 4)) {
                p = ExpandKeyword(g, b, h)
            }
            if (p == null && (h & 1)) {
                p = ExpandFieldReference(g, b, h)
            }
            k += (p != null) ? p: o + b + o;
            s = u + 1;
            q = (s < d.length) ? d.indexOf(o, s) : -1
        } else {
            k += d.substr(q);
            q = -1;
            s = d.length
        }
    }
    if (s > 0 && s < d.length) {
        k += d.substr(s)
    }
    return k
}
function ExpandStringInDollarProcess(g, b, p, v, q) {
    var I = " ";
    var C = b.split(I);
    var s = "$";
    var B = '"';
    var o = -2;
    var w = "";
    var h = false;
    var k = false;
    for (var G = 0; G < C.length; G++) {
        var D = C[G];
        k = false;
        var u = D;
        if (D.length <= 0) {
            if (h) {
                w += " "
            }
            continue
        } else {
            if (h) {
                w += " "
            }
        }
        if (!h) {
            o++
        }
        var d = D.indexOf(s, 1);
        if (!h && D.substr(0, 1) == s && D.substr(D.length - 1, 1) == s && d == D.length - 1) {
            if (D.length > 1) {
                var A = D.substring(1, D.length - 1);
                var f = null;
                if ((p & 2) || (p & 4)) {
                    f = ExpandKeyword(g, A, p)
                }
                if (f == null && (p & 1)) {
                    f = (q && o >= 0 && o < v.length) ? ExpandFieldReference(g, A, p, v[o]) : ExpandFieldReference(g, A, p)
                }
                if (f != null) {
                    D = f
                }
            }
        } else {
            if (h || D.substr(0, 1) == B || D.substr(D.length - 1, 1) == B) {
                var y = (D.substr(0, 1) == B) ? true: false;
                if (h && y) {
                    y = false
                }
                if (h && D.substr(D.length - 1, 1) == B) {
                    h = false;
                    k = true
                } else {
                    if (D.substr(0, 1) == B) {
                        if (D.length == 1) {
                            h = true
                        } else {
                            h = (D.substr(D.length - 1, 1) == B) ? false: true
                        }
                    }
                }
                var E = D;
                if (y) {
                    E = " " + D
                }
                var H = D.indexOf(s);
                if (H >= 0) {
                    E = (y) ? " ": ""
                }
                E += ExpandPart(g, D, p);
                D = E
            } else {
                if (D.indexOf(s) != -1) {
                    D = ExpandPart(g, D, p)
                }
            }
        }
        if (w.length > 0 && !h && !k) {
            w += " "
        }
        if (D.length > 0) {
            w += D
        }
    }
    return w
}
function ExpandString(f, h, d, b, k, g) {
    if (h.indexOf("$") == -1) {
        return h
    }
    var o = ExpandStringInDollar(f, h, d, b, k, g);
    if ((d & 4) && ARKWIsTemporalString(f, o)) {
        o = ExpandStringInDollar(f, o, d, b, k, g)
    }
    return o
}
function ExpandStringProcess(d, f, b, g, k) {
    if (f.indexOf("$") == -1) {
        return f
    }
    var h = ExpandStringInDollarProcess(d, f, b, g, k);
    if ((b & 4) && ARKWIsTemporalString(d, h)) {
        h = ExpandStringInDollar(d, h, b)
    }
    return h
}
function setGlobalFields(d) {
    if (!flashAppInit) {
        return
    }
    try {
        var f = getCookie("JSESSIONID");
        if (f != null && f.length > 0) {
            if (SharedObjectFlashApp != null) {
                d = d.JScriptFlexEncode();
                SharedObjectFlashApp.setFieldString(f, d)
            }
        }
    } catch(b) {}
}
function getGlobalFields() {
    if (!flashAppInit) {
        var b = weGetOpener(getTopWinWindowID_NS());
        if (b == null) {
            b = weGetARWindowOpener()
        }
        if ((gfTempStorage == null) && (b)) {
            gfTempStorage = b.getProxyGlobalFields();
            if (gfTempStorage == null) {
                gfTempStorage = b.getGlobalFields()
            }
        }
        if (gfTempStorage != null) {
            return gfTempStorage
        }
        return ""
    }
    var g = getCookie("JSESSIONID");
    var f = null;
    try {
        if (g != null && g.length > 0) {
            if (SharedObjectFlashApp != null) {
                f = SharedObjectFlashApp.getFieldString(g)
            }
        }
    } catch(d) {}
    if (f == null) {
        f = ""
    }
    return f
}
function removeGlobalFields() {
    var d = getCookie("JSESSIONID");
    try {
        if (d != null && d.length > 0) {
            if (SharedObjectFlashApp != null) {
                value = SharedObjectFlashApp.removeFieldString(d)
            }
        }
    } catch(b) {}
}
function setProxyGlobalFields(b) {
    gfProxyTempStorage = b
}
function getProxyGlobalFields() {
    return (gfProxyTempStorage)
}
var flashInit = false;
var flashAppInit = false;
var gfTempStorage = null;
var gfProxyTempStorage = null;
var SharedObjectFlashApp = null;
function initFlashApp() {
    flashInit = true;
    var d = document.getElementById("globaldata");
    if (d != null) {
        return
    }
    var f = document.createElement("div");
    f.setAttribute("id", "globaldata");
    f.style.top = "1000px";
    f.style.left = "5000px";
    f.style.width = "100px";
    f.style.height = "100px";
    var b = "<object id='SharedObjects' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' height='100%' width='100%'>";
    b += "<param name='flashvars' value='bridgeName=SharedObjects'/>";
    b += "<param name='src' value='";
    b += RelContextPath;
    b += "resources/swf/SharedObjects.swf' />";
    b += "<embed name='SharedObjects' pluginspage='http://www.macromedia.com/go/getflashplayer' src='";
    b += RelContextPath;
    b += "resources/swf/SharedObjects.swf' height='100%' width='100%' flashvars='bridgeName=SharedObjects'/>";
    b += "</object>";
    document.body.appendChild(f);
    f.innerHTML = b
}
function flashAppInitialized() {
    flashAppInit = true;
    SharedObjectFlashApp = (navigator.appName.indexOf("Microsoft") != -1) ? window.SharedObjects: document.SharedObjects;
    if (gfTempStorage != null) {
        setGlobalFields(gfTempStorage);
        gfTempStorage = null
    } else {
        FieldList.SetAllGlobals(0)
    }
}
function DeserializeGlobals(name) {
    var ck = null;
    var flashCookie = null;
    if (name == "GF") {
        var flashCookie = getCookie("FC");
        if (flashCookie == "1") {
            if (!flashInit) {
                initFlashApp()
            }
            ck = getGlobalFields()
        }
    }
    if (flashCookie == null) {
        ck = loadCookie(name)
    }
    if (ck != null && ck.length > 0) {
        var vals;
        eval("vals = " + ck + ";");
        return vals
    }
    return {}
}
function SerializeGlobals(d, b, k) {
    var q = [];
    weDeepSerialise(k, q);
    q = q.join("");
    var p = document.cookie;
    var s = loadCookie(b);
    var g = p.length;
    if (s != null) {
        g -= (3 + encodeURIComponent(s).length)
    }
    g += 3 + encodeURIComponent(q).length;
    if (b == "GF") {
        var o = getCookie("FC");
        if (o == null || o == "0") {
            if (((3 + encodeURIComponent(q).length) > 3000) || g >= 4096) {
                deleteCookie("GF", "/");
                o = "1";
                setCookie("FC", o, null, "/", null, null)
            }
        }
        if (o == "1") {
            if (!flashInit) {
                initFlashApp()
            }
            if (flashAppInit) {
                setGlobalFields(q)
            } else {
                gfTempStorage = q
            }
            return
        }
    }
    if (g >= 4096) {
        if (getCurWFC_NS(d) == null) {
            var h = {
                t: 2,
                n: 9360,
                m: null,
                a: null
            };
            var f = promptBar.msgTypeToSysMsgDest(promptBar.ARTypetoPromptType(2));
            new WorkflowContext(d, {
                f: WC_DisplayMessage,
                a: [d, [{
                    mstat: h,
                    msgloc: f
                }]]
            })
        } else {
            throw new WorkflowException(d, 0, [{
                t: 2,
                n: 9360,
                m: null,
                a: null
            }])
        }
    } else {
        setCookie(b, q, null, "/", null)
    }
}
function setCookie(f, h, b, o, g) {
    var k = false;
    if (document.URL.indexOf("https://") == 0) {
        k = true
    }
    var d = f + "=" + encodeURIComponent(h) + ((b) ? "; expires=" + b.toGMTString() : "") + ((o) ? "; path=" + o: "") + ((g) ? "; domain=" + g: "") + ((k) ? "; secure": "");
    document.cookie = d;
    if (typeof cookies == "object") {
        if (cookies[f] != undefined) {
            cookies[f] = h
        }
    }
}
function deleteCookie(d, g, f) {
    var b = new Date();
    b.setTime(b.getTime() - 1);
    setCookie(d, "", b, g, f);
    if (typeof cookies == "object") {
        if (cookies[d] != undefined) {
            cookies[d] = ""
        }
    }
}
function ARRegisterTableRefreshInterval(b, g, d) {
    window.clearInterval(getTbRefreshIntervals_NS(b)[g.mID]);
    delete getTbRefreshIntervals_NS(b)[g.mID];
    g.mRefreshInterval = d;
    if (d > 0) {
        var f = window.setInterval(function() {
            new WorkflowContext(b, {
                t: g,
                f: g.Refresh,
                a: [ - 1, 0, false]
            })
        },
        d * 60 * 1000);
        getTbRefreshIntervals_NS(b)[g.mID] = f
    }
}
function FormatDate(f) {
    var b = localeInfo.daysShort[f.getDay()] + " " + localeInfo.monthsShort[f.getMonth()] + " " + f.getDate() + " " + f.getFullYear() + " " + (f.getHours() < 10 ? ("0" + f.getHours()) : f.getHours()) + ":" + (f.getMinutes() < 10 ? ("0" + f.getMinutes()) : f.getMinutes()) + ":" + (f.getSeconds() < 10 ? ("0" + f.getSeconds()) : f.getSeconds()) + "." + f.getMilliseconds();
    return b
}
function colorValue(s) {
    if (s) {
        var f = s.indexOf("#") > -1;
        var k = ((f) ? /^(\w{2})(\w{2})(\w{2})$/: /^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/);
        var q = k.exec(s.replace("#", ""));
        if ((q) && (q.length == 4)) {
            var h = (f) ? 16 : 10;
            var p = (parseInt(q[1], h).toString(16));
            p = ((p == "0") ? "00": p);
            var o = (parseInt(q[2], h).toString(16));
            o = ((o == "0") ? "00": o);
            var d = (parseInt(q[3], h).toString(16));
            d = ((d == "0") ? "00": d);
            return "#" + p + o + d
        }
    }
    return ""
}
var AbsDocumentPath;
function GetDocumentLocation() {
    var g = document.location;
    var d = g.protocol + "//" + g.hostname;
    if (g.port) {
        d += ":" + g.port
    }
    var f = g.pathname;
    var b = f.length;
    if (f.charAt(b - 1) != "/") {
        b = f.lastIndexOf("/");
        f = f.substring(0, b + 1)
    }
    return d + f
}
function SetContextPath() {
    if (typeof(AbsContextPath) == "undefined" || AbsContextPath == null) {
        AbsDocumentPath = GetDocumentLocation();
        AbsContextPath = AbsDocumentPath + RelContextPath;
        var f = AbsContextPath.split("/");
        var d = [];
        for (var b = 0; b < f.length; ++b) {
            if (f[b] == "..") {
                d.pop()
            } else {
                d.push(f[b])
            }
        }
        AbsContextPath = d.join("/")
    } else {
        AbsDocumentPath = ""
    }
}
function FakeButton_SetAlternative(p, d) {
    if (p.children[0] && p.children[0].children[0] && p.children[0].children[0].className == "btnimg") {
        var h = p.children[0].children[0];
        if (Boolean(parseInt(h.getAttribute("arimgcenter"))) == true) {
            var f = h.getAttribute("artxt");
            var o = (d) ? getLocalizedMessage("{0} Disabled", [f]) : f;
            h.alt = o;
            h.title = o
        }
    } else {
        var k = SharedSupport_GetAnchorText(p);
        if (k.trim(1 | 2) == "") {
            k = p.artxt
        }
        var g = Field_FromElement(p.parentElement);
        if (g != null && (g.mObj.getAttribute("artype") == "AttachmentPool" || g.mObj.getAttribute("artype") == "Table")) {
            var b = [k, g.GLabel()];
            p.title = (d) ? getLocalizedMessage("{0} for table {1} is disabled", b) : getLocalizedMessage("{0} for table {1}", b)
        } else {
            p.title = (d) ? getLocalizedMessage("{0}. Disabled", [k]) : k
        }
    }
}
function SharedSupport_GetAnchorText(b) {
    var d = [];
    var f = b.firstChild;
    while (f) {
        if (f.firstChild) {
            f = f.firstChild
        } else {
            if (f.nodeType == 3) {
                d.push(f.nodeValue)
            }
            while (! (f.nextSibling)) {
                f = f.parentNode;
                if ((f == b) || (f == null)) {
                    d = d.join("");
                    return d
                }
            }
            f = f.nextSibling
        }
    }
    return ""
}
function FakeButton_MouseDown(d, b) {
    if (!FakeButton_Disabled(d)) {
        d.className = d.className.replace(/btn3d/, "btn3ddown")
    }
}
function FakeButton_MouseUpOut(d, b) {
    d.className = d.className.replace(/btn3ddown/, "btn3d")
}
function FakeButton_Disabled(b) {
    return b.className.indexOf("btnd") != -1
}
function FakeButton_TabableElementSelector(b) {
    if (!FakeButton_Disabled(b) && (!b.style || (b.style.visibility != "hidden"))) {
        return b
    } else {
        return null
    }
}
function FakeButton_Find(g) {
    for (var d = 0; g; g = g.parentNode) {
        if (g.nodeType == 1 && g.tagName == "A" && g.className) {
            var f = g.className.split(" ");
            for (var b in f) {
                if (f[b] == "btn" || f[d] == "btnflt" || f[b] == "pagebtn") {
                    return g
                }
            }
        }
    }
    return null
}
function getLocalizedMessage(h, b, f) {
    var d = (f == null) ? h: f + "|" + h;
    var g = (typeof localizedMessages == "undefined") ? window.weOpener.localizedMessages[d] : localizedMessages[d];
    if (g == null) {
        g = h
    }
    if (b == null || b.length < 0) {
        return g
    }
    return subArgsMessages(g, b)
}
function subArgsMessages(k, b) {
    var g = k;
    if (b == null || b.length < 0) {
        return g
    }
    var f;
    var d = 0;
    while (true) {
        var h = 0;
        f = new RegExp("\\{" + d + "\\}", "gi");
        while (f.test(g)) {
            g = g.replace(f, b[d]);
            h++
        }
        if (h == 0) {
            break
        }
        d++
    }
    return g
}
function CompileFunction(str, args, subs) {
    for (var i in subs) {
        str = str.replace(new RegExp(i, "g"), subs[i])
    }
    eval("window.CompiledFunction=function(" + args + "){" + str + "}")
}
function ComputeElementPosition(g, f, b, k) {
    while (g != f) {
        var h = parseInt(g.style.borderTopWidth);
        var d = parseInt(g.style.borderLeftWidth);
        k += g.offsetTop;
        b += g.offsetLeft;
        b -= g.scrollLeft;
        k -= g.scrollTop;
        if (!isNaN(h)) {
            b += h
        }
        if (!isNaN(d)) {
            k += d
        }
        g = g.offsetParent
    }
    return {
        x: b,
        y: k
    }
}
var head = document.getElementsByTagName("head")[0];
function createScriptTag(d, f) {
    var b = document.createElement("script");
    b.setAttribute("type", "text/javascript");
    b.setAttribute("language", "JavaScript");
    b.setAttribute("src", d);
    head.appendChild(b);
    if (typeof f != "undefined") {
        f()
    }
}
function createStyleTag(b) {
    var d = document.createElement("link");
    d.href = b;
    d.rel = "stylesheet";
    d.type = "text/css";
    document.body.appendChild(d)
}
var OpenedMenu = null;
function Menu_DispatchEvent(f, d) {
    if (OpenedMenu == null) {
        return false
    }
    if (f == 4 && OpenedMenu.mElementStack.length > 0) {
        return OpenedMenu.mElementStack[OpenedMenu.mElementStack.length - 1].HandleKeyEvent(d)
    }
    var g = d.element;
    while (g && g != document.body) {
        var b = g.getAttribute("armenuelementserial");
        if (g.tagName == "DIV" && b && b.length > 0) {
            OpenedMenu.mElements[g.getAttribute("armenuelementserial")].HandleMouseEvent(f, d);
            return true
        }
        g = g.parentNode
    }
    if (f == 2 || (f == 0)) {
        Menu_Close()
    }
    return false
}
function needPNGFixup() {
    var b = false;
    return b
}
var nextZIndex = 100001;
function GetAppStyleSheet(f) {
    var b = getCurrentWindowID_NS();
    var d = (((ARKWGetStringByIdx(b, 21) != null) ? ARKWGetStringByIdx(b, 21) : "") == "") ? "": f + "apps/" + encodeURIComponent(ARKWGetStringByIdx(b, 7)) + "/" + encodeURIComponent(((ARKWGetStringByIdx(b, 21) != null) ? ARKWGetStringByIdx(b, 21) : "")) + "/resources/stylesheets/ARSystem.css"
}
function FakeButton_SetDisable(g, d) {
    var b = (g.className.indexOf("btnflt") != -1);
    var f = (b) ? " btndflt": " btnd";
    g.className = g.className.replace(/[ ]*(btndflt|btnd)[ ]*/, " ");
    if (d) {
        g.className += f
    }
    if (g.firstChild && g.firstChild.firstChild && g.firstChild.firstChild.className == "btnimg") {
        FakeButton_SetAlternative(g, d)
    }
}
var LogWindow = null;
var clientLogEnabled = serverLogEnabled = timingsLogEnabled = 0;
var logTimings = false;
function LogInit() {
    clientLogEnabled |= ARPrefsGetAsNumber(20112);
    timingsLogEnabled |= ARPrefsGetAsNumber(23605);
    serverLogEnabled |= ARPrefsGetAsNumber(20113) | ARPrefsGetAsNumber(20114) | ARPrefsGetAsNumber(20115);
    LogInit1()
}
function LogInit1() {
    try {
        if (LogWindow == null || LogWindow.closed) {
            var o = weGetOpener(getTopWinWindowID_NS());
            if (o != null && !o.closed && o.LogWindow && !o.LogWindow.closed) {
                LogWindow = o.LogWindow
            }
        }
    } catch(f) {}
    if ((clientLogEnabled || serverLogEnabled || timingsLogEnabled) && (LogWindow == null || LogWindow.closed)) {
        var k = 0;
        var h = 0;
        var g = Math.floor(window.screen.availWidth / 2);
        var b = Math.floor(window.screen.availHeight / 2);
        var d = (AbsContextPath + "resources/html/Blank.html");
        if (d.indexOf("https") == -1) {
            d = ""
        }
        LogWindow = window.open(d, "Log" + document.domain.replace(/[^A-Za-z0-9_]/g, "_"), "width=" + (g - 10) + ",height=" + (b - 28) + ",top=" + h + ",left=" + k + ",scrollbars,resizable=yes");
        LogWindow.document.write('<html><head><meta http-equiv="content-type" content="text/html;charset=utf-8"><title>Workflow Logging - ' + document.domain + "</title><style>pre { margin-bottom:0px;margin-top:0px}</style></head><body>")
    }
}
function LogWrite(d, b) {
    if (b) {
        if (!serverLogEnabled && !timingsLogEnabled) {
            return
        }
    } else {
        if (!clientLogEnabled) {
            return
        }
    }
    LogInit1();
    LogWindow.document.write("<pre>" + d + "</pre>");
    LogWindow.scroll(0, 1000000000)
}
function LogAndAlert(b) {
    if (clientLogEnabled) {
        LogWrite("Alert: " + b)
    }
    alert(b)
}
var curClickElement = null;
FormEvent.Trampoline = function(b) {
    return function(g) {
        var f = new FormEvent(g);
        var d = b(f);
        if (typeof d == "boolean" && d == false) {
            f.StopDefault()
        } else {
            if (typeof d == "string") {
                return d
            }
        }
    }
};
function FormEvent() {
    var b = 0;
    var f = null;
    if (arguments.length == 2) {
        b = arguments[0];
        f = arguments[1]
    } else {
        f = arguments[0]
    }
    this.mStoppedDefault = false;
    if (typeof f != "number") {
        this.PDBuild(f);
        if (getFormContext(b)) {
            realtimeKeyMap[49] = this.shift ? 1 : 0;
            realtimeKeyMap[50] = this.alt ? 1 : 0;
            realtimeKeyMap[51] = this.ctrl ? 1 : 0
        }
    } else {
        var d = getFields_NS(b)[f].GetFocusElement();
        this.alt = this.ctrl = this.shift = this.key = this.ox = this.oy = this.button = 0;
        this.element = d
    }
}
FormEvent.prototype.PDBuild = function(b) {
    this.alt = b.altKey;
    this.ctrl = b.metaKey;
    this.shift = b.shiftKey;
    this.key = b.keyCode;
    this.button = b.button;
    this.meta = b.metaKey;
    this.ox = window.event.offsetX;
    this.oy = window.event.offsetY;
    this.element = b.target;
    if (this.element != null && this.element.nodeType == 3) {
        this.element = this.element.parentNode
    }
    this.mEventObject = b;
    this.mMouseX = window.event.clientX;
    this.mMouseY = window.event.clientY
};
FormEvent.prototype.PDStopBubbling = function() {
    this.mEventObject.stopPropagation()
};
FormEvent.prototype.PDStopDefault = function() {
    if (this.mEventObject.preventDefault) {
        this.mEventObject.preventDefault()
    }
    this.mEventObject.stopPropagation();
    this.mStoppedDefault = true
};
FormEvent.prototype.PDSetKeyCode = function(b) {};
FormEvent.PDFireChangeEvent = function(d) {
    var b = document.createEvent("HTMLEvents");
    b.initEvent("change", true, false);
    d.dispatchEvent(b)
};
FormEvent.PDFireClickEvent = function(d) {
    var b = document.createEvent("MouseEvents");
    b.initEvent("click", true, true);
    d.dispatchEvent(b)
};
FormEvent.PDFireClickEventFromSRCElement = function(d, g, f) {
    var b = document.createEvent("MouseEvents");
    b.initEvent("click", true, true);
    curClickElement = {
        ele: g,
        screenX: f.screenX,
        screenY: f.screenY
    };
    d.dispatchEvent(b)
};
FormEvent.prototype.StopBubbling = FormEvent.prototype.PDStopBubbling;
FormEvent.prototype.StopDefault = FormEvent.prototype.PDStopDefault;
FormEvent.prototype.SetKeyCode = FormEvent.prototype.PDSetKeyCode;
FormEvent.FireChangeEvent = FormEvent.PDFireChangeEvent;
FormEvent.FireClickEvent = FormEvent.PDFireClickEvent;
FormEvent.FireClickEventFromSRCElement = FormEvent.PDFireClickEventFromSRCElement;
FormEvent.lastMouseDownEvent = null;
function FillLayoutPolicy() {
    this.mNumVisibleChildren = 0;
    this.mLayoutFields = {};
    this.mWidth = 0;
    this.mHeight = 0
}
FillLayoutPolicy.prototype.RegisterLayoutField = function(g, d) {
    this.mLayoutFields[g.mID] = g;
    this.mNumVisibleChildren++;
    if (d == true) {
        var b = Math.round(100 / this.mNumVisibleChildren);
        for (var f in this.mLayoutFields) {
            if (this.mLayoutFields[f] != null) {
                this.mLayoutFields[f].perWidth = 100;
                this.mLayoutFields[f].perHeight = b
            }
        }
        this.ReCalculateLayout()
    }
};
FillLayoutPolicy.prototype.DeRegisterLayoutField = function(f) {
    if (f in this.mLayoutFields) {
        this.mLayoutFields[f] = null;
        this.mNumVisibleChildren--;
        var b = Math.round(100 / this.mNumVisibleChildren);
        for (var d in this.mLayoutFields) {
            if (this.mLayoutFields[d] != null) {
                this.mLayoutFields[d].perWidth = 100;
                this.mLayoutFields[d].perHeight = b
            }
        }
        this.ReCalculateLayout()
    }
};
FillLayoutPolicy.prototype.ReCalculateNewLayout = function(d, b) {
    this.mWidth = d;
    this.mHeight = b;
    for (var f in this.mLayoutFields) {
        if (this.mLayoutFields[f] != null) {
            this.mLayoutFields[f].ResizeTo(d, b)
        }
    }
};
FillLayoutPolicy.prototype.ReCalculateLayout = function() {
    for (var b in this.mLayoutFields) {
        if (this.mLayoutFields[b] != null) {
            this.mLayoutFields[b].ResizeTo(this.mWidth, this.mHeight)
        }
    }
};
function FormPane(b, f, o, h, k, g) {
    this.windowID = b;
    this.mFixedHeight = f;
    this.mHandler = k;
    this.mHandlerObj = (g != null) ? g: this;
    this.mObj = o;
    this.mVisible = h;
    this.mFillStyle = 0;
    this.mNewZindex = this.mOrigZIndex = this.mObj.style.zIndex;
    this.mObj.setAttribute("arwindowid", b);
    var d = this.mObj.getAttribute("arfillstyle");
    if (d != null) {
        this.mFillStyle = parseInt(d)
    }
    if (this.mFillStyle == 1) {
        this.mObj.style.overflow = "auto"
    }
    if (!h) {
        this.mObj.style.left = 100000
    }
    this.mHeight = 0;
    this.mY = 0;
    getFormPaneMPanes_NS(this.windowID).push(this)
}
FormPane.prototype.SetNewZIndex = function(b) {
    this.mNewZIndex = b;
    this.mObj.style.zIndex = b
};
FormPane.prototype.ResetZIndex = function() {
    this.mNewZIndex = this.mOrigZIndex;
    this.mObj.style.zIndex = this.mOrigZIndex
};
FormPane.prototype.ResizeChildren = function(d, b) {
    for (var f in this.mLayoutFields) {
        if (this.mLayoutFields[f] != null) {
            this.mLayoutFields[f].ResizeTo(d, b)
        }
    }
};
FormPane.prototype.SVis = function(b) {
    this.mVisible = b;
    this.mObj.style.left = (b ? 0 : 100000)
};
FormPane.prototype.GVis = function() {
    return this.mVisible
};
FormPane.prototype.changeHeight = function(b) {
    this.mFixedHeight = b
};
FormPane.prototype.getHeight = function() {
    return this.mHeight
};
FormPane.Layout = function(f) {
    var E = getFormPaneMPanes_NS(f);
    var d = E.length,
    v = 0,
    k = 0;
    for (var g = 0; g < d; ++g) {
        var q = E[g];
        if (q.mVisible) {
            if (q.mFixedHeight != -1) {
                q.mHeight = q.mFixedHeight;
                v += q.mHeight
            } else {
                q.mHeight = 0; ++k
            }
        }
    }
    var u = getLogicalWindow(f);
    var p = 0;
    var D = 0;
    if (u) {
        p = u.mObj.clientHeight;
        D = u.mObj.clientWidth
    } else {
        p = window.innerHeight
    }
    if (v < p && k > 0) {
        var s = p - v;
        for (var g = 0; g < d; ++g) {
            var q = E[g];
            if (q.mVisible && q.mFixedHeight == -1) {
                var C = Math.floor(s / k);
                q.mHeight += C;
                s -= C; --k
            }
        }
    }
    var B = 0;
    for (var g = 0; g < d; ++g) {
        var q = E[g];
        if (q.mVisible) {
            q.mObj.style.height = q.mHeight;
            q.mObj.style.top = B;
            q.mY = B;
            if (q.mHandler) {
                q.mHandler.call(q.mHandlerObj, (D > 0) ? D: q.mObj.offsetWidth, q.mHeight)
            }
            B += q.mHeight
        }
    }
    var A = (D > 0) ? D: (window.innerWidth + 1);
    var b = getFormElements_NS(f)["FormContainer"],
    o = b.childNodes[1];
    if (getFormContainerPaneSH_NS(f) == null) {
        setFormContainerPaneSH_NS(f, o.getAttribute("arbkimgy"));
        setFormContainerPaneSW_NS(f, o.getAttribute("arbkimgx"))
    }
    if (o.nodeType == 1 && o.className == "FormContainerBackground") {
        o.style.height = (getFormContainerPane_NS(f).mFillStyle == 1) ? getFormContainerPane_NS(f).mHeight: (getFormContainerPane_NS(f).mHeight > getFormContainerPaneSH_NS(f) ? getFormContainerPane_NS(f).mHeight: getFormContainerPaneSH_NS(f));
        o.style.width = (getFormContainerPane_NS(f).mFillStyle == 1) ? (A - 1) : getFormContainerPaneSW_NS(f)
    }
    if (rtfEditor != null && rtfEditor.mEditing != null) {
        rtfEditor.UpdatePos()
    }
};
FormPane.Layout2 = function(b) {
    setARInitPane_NS(b, true);
    FormPane.Layout(b);
    setARInitPane_NS(b, null);
    for (var f in getLayoutParentFields_NS(b)) {
        var d = getLayoutParentFields_NS(b)[f];
        if (d == null || d.mObj.style.visibility == "hidden" || d.mObj.style.display == "none") {
            continue
        }
        d.ResizeChildren()
    }
};
function ToolbarButtonIterator(d, b) {
    var g = getFormElements_NS(d)["Toolbar"];
    do {
        if (! (typeof b == "function")) {
            Assert('(Form.js:143) typeof iter=="function"')
        }
    } while ( 0 );
    do {
        if (! (b.length == 2)) {
            Assert("(Form.js:144) iter.length==2")
        }
    } while ( 0 );
    do {
        if (! (g.childNodes[2].tagName == "TABLE")) {
            Assert('(Form.js:145) outer.childNodes[2].tagName=="TABLE"')
        }
    } while ( 0 );
    var f = g.childNodes[2].firstChild.firstChild.firstChild;
    while (f != null) {
        if (f.nodeType == 1) {
            do {
                if (! (f.tagName == "TD")) {
                    Assert('(Form.js:149) gcell.tagName=="TD"')
                }
            } while ( 0 );
            var h = f.firstChild;
            while (h != null) {
                if (h.nodeType == 1) {
                    do {
                        if (! (h.tagName == "A")) {
                            Assert('(Form.js:153) gbut.tagName=="A"')
                        }
                    } while ( 0 );
                    b(h, h.className.split(" ")[0])
                }
                h = h.nextSibling
            }
        }
        f = f.nextSibling
    }
}
var ModeToToolbarItemMap = {};
ModeToToolbarItemMap.QUERY = "newsearch";
ModeToToolbarItemMap.CREATE = "newrequest";
ModeToToolbarItemMap["SET ALL"] = "modifyall";
var ToolbarItemMap = {
    searchsavechanges: function(b) {
        if ((getARStateCurrent_NS(b) == 4)) {
            return getCurWFC_NS(b).executeAll({
                f: FormActionButtonFlags[1002].f,
                a: [b]
            })
        } else {
            if ((getARStateCurrent_NS(b) == 1)) {
                return getCurWFC_NS(b).executeAll({
                    f: FormActionButtonFlags[1001].f,
                    a: [b]
                })
            } else {
                if ((getARStateCurrent_NS(b) == 5) || (getARStateCurrent_NS(b) == 6)) {
                    return getCurWFC_NS(b).executeAll({
                        f: FormActionButtonFlags[1003].f,
                        a: [b]
                    })
                }
            }
        }
    },
    newsearch: 1009,
    newrequest: 1010,
    modifyall: 1004,
    savedsearches: 1013,
    quickreports: 1014,
    advancedsearch: function(b) {
        if (getQBPane_NS(b) != null && (getARStateCurrent_NS(b) == 4)) {
            F(b, 1005).VisClick()
        }
    },
    clear: 1006,
    settodefaults: 1007,
    statushistory: 1011,
    help: 1008,
    home: 1012,
    logout: ARProcessExitApp
};
function BuildToolbar(d, b, h) {
    setToolBarPane_NS(d, new FormPane(d, b, h, true, null, null));
    settbmaxheight_NS(d, b);
    new ToolbarButtonIterator(d,
    function(q, p) {
        if (!q.getAttribute("arwindowid")) {
            q.setAttribute("arwindowid", d)
        }
        if (p == "searchsavechanges") {
            q.parentNode.style.width = q.offsetWidth + 4;
            q.parentNode.style.textAlign = "center"
        }
    });
    var k = h.childNodes[1];
    if (!k.getAttribute("arwindowid")) {
        k.setAttribute("arwindowid", d)
    }
    setflipper_NS(d, k);
    var f = k.childNodes[0],
    o = k.childNodes[1];
    var g = true;
    f.style.visibility = "hidden";
    setrightimg_NS(d, f);
    setdownimg_NS(d, o);
    settbopen_NS(d, g)
}
function SimulateModeChange(b, d) {
    setTimeout(function() {
        if (! (d in ModeToToolbarItemMap)) {
            return
        }
        if (formModalList.mStack.length > 0) {
            formModalList.Reset()
        }
        var f = ToolbarItemMap[ModeToToolbarItemMap[d]];
        if (typeof f == "function") {
            new WorkflowContext(b, {
                f: f,
                a: [b]
            })
        } else {
            if (f in FormActionButtonFlags) {
                new WorkflowContext(b, {
                    f: FormActionButtonFlags[f].f,
                    a: [b]
                })
            }
        }
    },
    10)
}
Toolbar_Click = function(b, d) {
    var h = d.element;
    if (h == getflipper_NS(b) || h == getrightimg_NS(b) || h == getdownimg_NS(b)) {
        settbopen_NS(b, !gettbopen_NS(b));
        var g = getToolBarPane_NS(b).mObj;
        getrightimg_NS(b).style.visibility = (gettbopen_NS(b) ? "hidden": "inherit");
        getdownimg_NS(b).style.visibility = (gettbopen_NS(b) ? "inherit": "hidden");
        g.childNodes[2].style.visibility = (gettbopen_NS(b) ? "inherit": "hidden");
        getToolBarPane_NS(b).mFixedHeight = (gettbopen_NS(b) ? gettbmaxheight_NS(b) : getflipper_NS(b).offsetHeight);
        FormPane.Layout(b)
    } else {
        var h = FakeButton_Find(d.element);
        var f = h.className.split(" ");
        if (f.length >= 1) {
            f = f[0]
        }
        if (! (f in ToolbarItemMap)) {
            return
        }
        var k = ToolbarItemMap[f];
        if (typeof k == "function") {
            return k(b)
        } else {
            if (k in FormActionButtonFlags) {
                return getCurWFC_NS(b).executeAll({
                    f: FormActionButtonFlags[k].f,
                    a: [b, h]
                })
            }
        }
    }
};
Toolbar_UpdateFormActionButtons = function(b) {
    new ToolbarButtonIterator(b,
    function(f, h) {
        var o = ToolbarItemMap[h];
        if (typeof o != "function" && typeof o != "undefined") {
            var g = ((FormActionButtonFlags[o].c & (1 << getARStateCurrent_NS(b))) == 0);
            if (o == 1011 && !getFields_NS(b)[15]) {
                g = false
            } else {
                if (o == 1013 && getuserSearches_NS(b) == null) {
                    g = false
                } else {
                    if (o == 1014 && getquickReportsExisting_NS(b) == null) {
                        g = false
                    }
                }
            }
            FakeButton_SetDisable(f, !g)
        } else {
            if (h == "advancedsearch") {
                FakeButton_SetDisable(f, getQBPane_NS(b) == null || !(getARStateCurrent_NS(b) == 4))
            } else {
                if (h == "searchsavechanges") {
                    var k = getStateMgr_NS(b).GetActionButtonString();
                    NodeWrite(f.childNodes[1], k);
                    if (((getARStateCurrent_NS(b) == 4) && (typeof getForm_NS(b).TbSearch != "undefined" && getForm_NS(b).TbSearch == false)) || (!(getARStateCurrent_NS(b) == 4) && !getStateMgr_NS(b).IsSaveAllowed(b)) || ((getARStateCurrent_NS(b) == 3))) {
                        f.style.visibility = "hidden";
                        FakeButton_SetDisable(f, true)
                    } else {
                        f.style.visibility = "inherit";
                        FakeButton_SetDisable(f, false)
                    }
                }
            }
        }
    });
    if (getToolBarPane_NS(b)) {
        var d = getToolBarPane_NS(b).mObj;
        d.firstChild.className = "TBTopBarStatus TBTopBarStatusMode" + getARStateCurrent_NS(b)
    }
};
Toolbar_DirtyFlagChanged = function(b, d) {
    if (ApplyButtonIDs[getARStateCurrent_NS(b)]) {
        new ToolbarButtonIterator(b,
        function(f, g) {
            if (g == "searchsavechanges") {
                FakeButton_SetDisable(f, !d)
            }
        })
    }
};
window.onunload = FormEvent.Trampoline(function(f) {
    document.oncontextmenu = function() {};
    licenseSessionCloseWindow();
    var b = getTopWinWindowID_NS();
    if (weAmDialogue(this.name)) {
        var d = this.weGetOpener(b);
        if (d) {
            if (d.weDisabledObj) {
                d.weEnableStuff(b)
            }
            if (d.weDialogueName) {
                d.weDialogueName = null
            }
        }
    } else {
        if (!globalLogout && window.weunloadcalled == undefined && getFormContext(b)) {
            weOnUnload(b)
        }
    }
});
function ResizeResultsList(d, f) {
    if (!getResultsListPane_NS(d).GVis()) {
        return
    }
    var b = getFields_NS(d);
    if (1020 in b) {
        b[1020].Resize(f ? null: window.innerWidth + 1, getResultsListPane_NS(d).mHeight)
    }
}
function SetWindowSize(b) {
    try {
        var g = ARPrefsGetAsNumber(23204);
        var d = getForm_NS(b).maximizeWindow;
        if (g == 1 && !d) {
            d = true
        }
        if (d && !weAmDialogue(window.name)) {
            top.window.moveTo(0, 0);
            top.window.resizeTo(screen.availWidth, screen.availHeight)
        }
    } catch(f) {}
}
function detectPopupBlockers() {
    var d = getCookie("P");
    if (d == null) {
        var b = 0;
        try {
            var o = 0;
            var k = screen.width;
            var f = window.open("about:blank", "PopupTest", "width=1,height=1,left=" + k + ",top=" + o + ",scrollbars=no,toolbar=no,menubars=no,location=no,status=no,titlebar=no");
            f.close()
        } catch(g) {
            window.focus();
            alert(getLocalizedMessage("Popup blockers must be disabled to use this application."));
            b = 1
        }
        var h = AbsContextPath.substring(0, AbsContextPath.length - 1);
        var p = h.lastIndexOf("/");
        var h = h.substring(p);
        setCookie("P", b + "", null, h, null)
    }
}
var windowStatus;
var sessionTimeoutInSec = 90 * 60;
var timeout;
var timeoutID;
function initSessionTimeoutCounter() {
    timeout = getCookie("st");
    if (timeout != null) {
        sessionTimeoutInSec = parseInt(timeout)
    }
    updateSessionTimeoutStatus(sessionTimeoutInSec);
    if (timeoutID != null) {
        clearTimeout(timeoutID)
    }
    timeoutID = setTimeout("setSessionTimeoutCounter()", 60000)
}
function updateSessionTimeoutStatus(b) {
    if (b <= 0) {
        window.status = windowStatus + " | 00:00"
    } else {
        hours = 0;
        mins = 0;
        out = "";
        hours = Math.floor(b / 3600);
        tmp = b % 3600;
        mins = Math.floor(tmp / 60);
        tmp = tmp % 60;
        if (hours > 9) {
            out += hours + ":"
        } else {
            out += (hours > 0) ? ("0" + hours + ":") : "00:"
        }
        if (mins > 9) {
            out += mins
        } else {
            out += "0" + mins
        }
        window.status = windowStatus + " | " + out
    }
}
function setSessionTimeoutCounter() {
    sessionTimeoutInSec -= 60;
    updateSessionTimeoutStatus(sessionTimeoutInSec);
    timeoutID = setTimeout("setSessionTimeoutCounter()", 60000)
}
function _ARSystemInitFunc(server, form, view, initFuncs) {
    var sfv = server + "_" + form + "_" + view;
    for (var i = 0; i < initFuncs.length; i++) {
        var initFuncName = (initFuncs[i] + sfv).ARToJSIdentifier();
        if (initFuncName in window) {
            eval(initFuncName + "();")
        }
    }
}
function SystemInit() {
    SetContextPath();
    detectPopupBlockers();
    licenseSessionInit()
}
function BrowserWindowInit(b) {
    UserData_Init();
    LogInit();
    if (ARPrefsGetAsNumber(23605)) {
        var d = new NDXGetAPITimings(b, true).GetResult();
        if (typeof d != "undefined" && d.m) {
            LogWrite(d.m, true)
        }
        logTimings = true
    }
}
function WindowInit(b, d) {
    if (b == getTopWinWindowID_NS()) {
        allocWindowID_NS()
    }
    wm.registerWindow(b, d);
    if (b == getTopWinWindowID_NS()) {
        getWindowMgr_NS().pushCurrentWindowID(b)
    }
}
function BuildFormInfo(d, p, k, b, o, h, g, f) {
    fc.registerContext(d, null, p, k, b, null, null, null, f);
    if (typeof h == "undefined" || h == null) {
        h = getBody()
    }
    new WorkflowContext(d, {
        f: Form_Init,
        a: [d, p, k, b, o, h, g]
    });
    if (!o) {
        if (getCurWFC_NS(d) == null) {
            if (FocusMgr.getFocusedID() == 0) {
                FocusMgr.SetFocusToFirst(d)
            }
        } else {
            setTimeout(function() {
                if (getCurWFC_NS(d) != null) {
                    setTimeout(arguments.callee, 100)
                } else {
                    if (FocusMgr.getFocusedID() == 0) {
                        FocusMgr.SetFocusToFirst(d)
                    }
                }
            },
            100)
        }
    }
}
function buildNewInlineForm(g, o, h, b, q, f, s, p) {
    var k = h + "_" + b + "_" + q;
    var d = ("formjs_" + k + "_loaded").ARToJSIdentifier();
    var u = ("uddjs_" + k + "_loaded").ARToJSIdentifier();
    new
    function() {
        if (typeof window[u] == "undefined" || typeof window[d] == "undefined") {
            setTimeout(arguments.callee, 1)
        } else {
            var v = getSFVSnippet(h, b, q);
            if (typeof v != "undefined" && v != null) {
                if (v.whdr != null && v.whdr != "") {
                    parseScript(v.whdr);
                    parseStyle(v.whdr)
                }
            }
            WindowInit(g, o);
            BuildFormInfo(g, h, b, q, true, f, s, p)
        }
    } ()
}
function ARSystemInit(d, h, f, b) {
    SystemInit();
    WindowInit(d, null);
    var g = window.opener;
    setTimeout(function() {
        var w = h + "_" + f + "_" + b;
        var o = ("uddjs_" + w + "_loaded").ARToJSIdentifier();
        if (typeof(window[o]) == "undefined") {
            if (RelContextPath != null) {
                var v = window.location.href;
                var k = v.substring(v.indexOf("//") + 2);
                k = k.substring(k.indexOf("/"));
                var s = k.split("?");
                if (s.length >= 2) {
                    var u = "cacheid=";
                    var q = s[1].split(/[&;]/g);
                    for (var p = q.length; p-->0;) {
                        if (q[p].lastIndexOf(u, 0) !== -1) {
                            q.splice(p, 1)
                        }
                    }
                    k = s[0] + "?" + q.join("&")
                }
                window.location.href = RelContextPath + "shared/login.jsp?" + k;
                return
            }
            window.status = getLocalizedMessage("Waiting to load {0}", ["udd.js"]);
            return
        }
        BrowserWindowInit(d);
        BuildFormInfo(d, h, f, b, false, null, null, (window.name == "") ? createARRootWindowName() : window.name);
        if ((enableAnimate) && (ARPrefsGetAsNumber(28510))) {
            createScriptTag(RelContextPath + "resources/javascript/" + encodeURIComponent("7.6.04 Build 002 201101141059") + "/" + ARMTGetBrowserTypeString() + "/AnimMgr.js")
        }
    },
    0)
}
var glTimestamp;
var hlength;
var ariever6 = false;
function Form_Init(v, V, U, f, B, o, ah) {
    var al = new Date();
    glTimestamp = al;
    SetWindowSize(v);
    StateMgr_Init(v);
    var Q = getSFV_NS(v);
    var g = ["uddjsinit"];
    _ARSystemInitFunc(Q.s, Q.f, Q.v, g);
    var aa = getUDDHolder(Q.s, Q.f, Q.v);
    aa.uddinit(v);
    ARKWSetup(v, getARKeywords_NS(v));
    windowStatus = ExpandString(v, "$USER$ | $SERVER$", 2 | 16);
    initSessionTimeoutCounter();
    var W = getARMenus_NS(v);
    for (var af in W) {
        new ARMenu(v, af, W[af])
    }
    var u = weAmDialogue(window.name) ? false: getForm_NS(v).ShowTb;
    ARKWSet(v, 30, AbsContextPath);
    DummyField = new Field(0, 0, {
        dbn: ""
    });
    var H = null;
    var p = null;
    var ac = o;
    if (ac.firstChild) {
        ac = ac.firstChild;
        while (ac) {
            if (ac.id) {
                if (ac.id == "PageLoadProgress") {
                    H = ac
                } else {
                    if (ac.getAttribute("arindex") == "FormApp") {
                        p = ac
                    }
                }
            }
            ac = ac.nextSibling
        }
    }
    if (p) {
        ac = p
    } else {
        ac = document.body
    }
    if (ac.firstChild) {
        ac = ac.firstChild;
        while (ac) {
            if (ac.id) {
                getFormElements_NS(v)[(ac.getAttribute("arindex") != null) ? ac.getAttribute("arindex") : ac.id] = ac
            }
            ac = ac.nextSibling
        }
    }
    delete getFormElements_NS(v)["PostAppletElement"];
    if (H) {
        if (B) {
            o.removeChild(H)
        } else {
            document.body.removeChild(H)
        }
    }
    if (p) {
        p.style.display = ""
    } else {
        document.body.style.display = ""
    }
    var y = getFormWorkflowHolderById(v);
    y.Activelink_Init(v);
    getFormDataHolderById(v).JField_Init(v);
    Field_Init(v, o);
    if (B) {
        Q = getSFVSnippet(V, U, f);
        if (typeof Q != "undefined" && Q != null) {
            if (Q.fp != null && Q.fp != "") {
                var J = document.createElement("div");
                J.setAttribute("arwindowid", v);
                document.body.appendChild(J);
                J.innerHTML = Q.fp.replace(/WIN_0_/gm, "WIN_" + v + "_");
                var aj = J;
                var ae = getLogicalWindow(v);
                if (aj.firstChild) {
                    aj = aj.firstChild;
                    while (aj) {
                        if (aj.nodeType == 1) {
                            document.body.appendChild(aj);
                            Field_Init(v, aj, true);
                            ae.mFloatingPanels.push(aj)
                        } else {
                            J.removeChild(aj)
                        }
                        aj = J.firstChild
                    }
                }
                document.body.removeChild(J)
            }
        }
        FieldList.SetAllGlobals(v)
    }
    Field_ExpandDefaultValues(v);
    if (!B) {
        MidTierDragDropMgrInst.init()
    }
    DragField_Init(v);
    DropField_Init(v);
    var S = getFormElements_NS(v)["FormContainer"],
    R = getFormElements_NS(v)["ResultsList"];
    var C = getFormElements_NS(v)["Splitter"],
    h = getFormElements_NS(v)["QueryBar"];
    var k = getFormElements_NS(v)["Toolbar"];
    var I = getFormElements_NS(v)["PromptBar"];
    var an = 0;
    var N = k.offsetHeight,
    ai = C.offsetHeight;
    var L = R.offsetHeight;
    if (h) {
        var ad = h.offsetHeight
    }
    if (!B) {
        an = I.offsetHeight
    }
    var A = !RLAtBottom(v);
    if (!weAmDialogue(window.name)) {
        BuildToolbar(v, N, k);
        if (!u) {
            var ab = getToolBarPane_NS(v);
            if (ab) {
                ab.SVis(false)
            }
            k.style.visibility = "hidden"
        }
    } else {
        k.style.visibility = "hidden"
    }
    L += 15;
    if (!B) {
        promptBar = new PromptBar(v, I);
        setPromptBarPane_NS(v, new FormPane(v, an, I, false, PromptBar.prototype.Resize, promptBar))
    }
    if (A) {
        setResultsListPane_NS(v, new FormPane(v, L, R, false, DTable.prototype.Resize, getFields_NS(v)[1020]));
        setSplitterPane_NS(v, new FormPane(v, ai, C, false, null, null))
    }
    setFormContainerPane_NS(v, new FormPane(v, -1, S, true, FillLayoutPolicy.prototype.ReCalculateNewLayout, getVUILayoutModel_NS(v)));
    if (!A) {
        setSplitterPane_NS(v, new FormPane(v, ai, C, false, null, null));
        setResultsListPane_NS(v, new FormPane(v, L, R, false, DTable.prototype.Resize, getFields_NS(v)[1020]))
    }
    if (h) {
        setQBPane_NS(v, new FormPane(v, ad, h, false, null, null))
    }
    CreateAdvancedSearchBar(v);
    if (!B) {
        window.URLParams = [];
        var X = /\?*(\w+)=([^\&]*)/g;
        var P;
        while (P = X.exec(window.location.search)) {
            if (P.length == 3) {
                try {
                    window.URLParams[P[1]] = decodeURIComponent(P[2].replace(/\+/g, " "))
                } catch(ak) {}
            }
        }
    }
    if (!B) {
        weOnLoad(v);
        hlength = history.length
    } else {
        if ("external" in top) {
            try {
                top.external.InlineFormLoaded(v)
            } catch(ak) {}
        }
    }
    if (!B) {
        SetupHandlers()
    }
    if (!B) {
        FocusMgr_Init();
        hoverState = new HoverState();
        toolTip = new ToolTip()
    }
    ARProcessEvent.InitKeywordsEtc(v);
    ARKWGetGlobalKeywords(v);
    try {
        var K = [];
        if (typeof y.RegisterIntervalEvents == "function") {
            y.RegisterIntervalEvents(v)
        }
        if (typeof ah != "undefined" && ah != null) {
            setWindowArgs_NS(v, ah)
        } else {
            if (getUDDHolderById(v).openingArgs != null) {
                setWindowArgs_NS(v, getUDDHolderById(v).openingArgs)
            }
        }
        var O = getWindowArgs_NS(v);
        if (typeof O != "undefined" && O != null) {
            if ("runGuide" in O) {
                K.push({
                    f: ARACTCallGuide,
                    a: [v, O.runGuide.server, O.runGuide.guidename, O.runGuide.hidden, O.runGuide.tableid, O.runGuide.selectedonly]
                })
            }
            if ("eid" in O) {
                var Y = {
                    qual: "4\\1\\1\\1\\2\\4\\" + O.eid.length + "\\" + O.eid + "\\",
                    fieldids: [],
                    fieldvals: [],
                    fieldtypes: []
                };
                K.push({
                    t: getStateMgr_NS(v),
                    f: getStateMgr_NS(v).OpenWindowQuery,
                    a: [v, 14, Y]
                })
            } else {
                if ("qual" in O) {
                    var s = 10;
                    if (("wMode" in O) && (O.wMode != 0) && (O.wMode != 1) && (O.wMode != 9)) {
                        s = O.wMode
                    }
                    if (typeof O.sort != "undefined") {
                        if (gettablePrefs_NS(v) == null) {
                            getUDDHolderById(v).tablePrefs = {
                                colSort: {},
                                colWs: {},
                                colOrd: {},
                                interval: {}
                            }
                        }
                        gettablePrefs_NS(v).colSort[1020] = O.sort
                    }
                    if (O.wMode != 2) {
                        if ("interval" in O && O.interval > 0) {
                            K.push({
                                f: ARRegisterTableRefreshInterval,
                                a: [v, getFields_NS(v)[1020], O.interval]
                            })
                        }
                        K.push({
                            t: getStateMgr_NS(v),
                            f: getStateMgr_NS(v).OpenWindowQuery,
                            a: [v, s, O.qual]
                        });
                        if (s == 12 || s == 13 || s == 14 || s == 15 || s == 16 || s == 17 || s == 18 || s == 19) {
                            return {
                                n: K
                            }
                        }
                    }
                }
            }
        }
        K.push({
            f: SetupState,
            a: [v]
        });
        for (var b in aa.vf) {
            var D = null;
            var Z = aa.vf[b].server;
            var G = aa.vf[b].form;
            var E = aa.vf[b].view;
            D = new NDXGetHTMLScriptForViewField(v, Z, ((ARKWGetStringByIdx(v, 21) != null) ? ARKWGetStringByIdx(v, 21) : ""), G, E, false).GetResult();
            if (E == null || E == "") {
                setSFMap(Z, G, D.viewname)
            }
            setSFVSnippet(Z, G, D.viewname, D);
            aa.vf[b].view = D.viewname;
            if (!ariever6) {
                InjectFormJS(aa.vf[b].server, aa.vf[b].form, aa.vf[b].view, aa.vf[b].cacheid, "")
            }
        }
        return {
            n: K
        }
    } finally {
        FormPane.Layout2(v);
        if (B) {
            wm.decInlineFormLoadCounter();
            if (wm.getInlineFormLoadCounter() == 0) {
                var w = wm.getInlineIntervalsLen();
                for (var ag = 0; ag < w; ++ag) {
                    var am = wm.popInlineInterval();
                    if (typeof am != "undefined") {
                        getFormContext(v).ALInterval.push(setInterval(am.func, am.interval))
                    }
                }
            }
        }
    }
}
function RLAtBottom(b) {
    if ((F(b, 1020) instanceof DTable) && F(b, 1020).GetAtBottom()) {
        return true
    }
    if (ARPrefsGetAsNumber(23207) == 4) {
        return true
    }
    return false
}
function BodyDrag(h) {
    var d = h.srcElement.getAttribute("arwindowid");
    var s = window.innerWidth;
    if (h.state == 0) {
        var p = (getFormContainerPane_NS(d).mY < getResultsListPane_NS(d).mY ? getFormContainerPane_NS(d).mY: getResultsListPane_NS(d).mY);
        var q = getFormContainerPane_NS(d).mY + getFormContainerPane_NS(d).mH,
        o = getResultsListPane_NS(d).mY + getResultsListPane_NS(d).mH;
        var k = (q > o ? q: o);
        if (p >= k) {
            WDEDragContext_Stop()
        }
        h.dragContext.SetDragBounds(0, p, s, k - p)
    } else {
        var g = parseInt(getSplitterPane_NS(d).mObj.style.top),
        f;
        if (!RLAtBottom(d)) {
            f = g - getResultsListPane_NS(d).mY
        } else {
            f = (getResultsListPane_NS(d).mY + getResultsListPane_NS(d).mHeight) - (g + getSplitterPane_NS(d).mObj.offsetHeight)
        }
        getResultsListPane_NS(d).mFixedHeight = (f < 8 ? 8 : f);
        FormPane.Layout(d)
    }
}
function NodeWrite(d, b) {
    while (d.hasChildNodes()) {
        d.removeChild(d.firstChild)
    }
    d.appendChild(document.createTextNode(b))
}
function FormAction_Submit(b) {
    return {
        c: {
            t: getStateMgr_NS(b),
            f: getStateMgr_NS(b).Submit,
            a: [b]
        }
    }
}
function FormAction_Query(b) {
    HidePromptBar();
    return {
        n: {
            t: getStateMgr_NS(b),
            f: getStateMgr_NS(b).Query,
            a: [b]
        }
    }
}
function FormAction_Modify(b) {
    HidePromptBar();
    return {
        n: {
            t: getStateMgr_NS(b),
            f: getStateMgr_NS(b).Modify,
            a: [b]
        }
    }
}
function FormAction_ModifyAll(b) {
    var d = getFields_NS(b)[1020];
    if (d.GetSelectedRowsByEntryId().length == 0) {
        getCurWFC_NS(b).status(9365)
    }
    return {
        n: {
            t: getStateMgr_NS(b),
            f: getStateMgr_NS(b).ARStateChange,
            a: [b, 6]
        }
    }
}
function FormAction_Clear(b) {
    Field_Clear(b, false)
}
function FormAction_SavedSearches(b, d) {
    if (getForm_NS(b).SavedSearchesMenu == null) {
        getForm_NS(b).SavedSearchesMenu = new SearchesMenu(b)
    }
    return {
        n: {
            f: getForm_NS(b).SavedSearchesMenu.Open,
            t: getForm_NS(b).SavedSearchesMenu,
            a: [d, 3]
        }
    }
}
function FormAction_QuickReports(b, d) {
    if (getForm_NS(b).QuickReportsMenu == null) {
        getForm_NS(b).QuickReportsMenu = new QuickReportsMenu(b)
    }
    return {
        n: {
            f: getForm_NS(b).QuickReportsMenu.Open,
            t: getForm_NS(b).QuickReportsMenu,
            a: [d, 3]
        }
    }
}
function FormAction_SetToDefaults(b) {
    return getStateMgr_NS(b).SetDefaults(b, false, true)
}
function FormAction_NewSearch(b) {
    HidePromptBar();
    if (getuserSearches_NS(b) != null) {
        getuserSearches_NS(b).lastSearch = null
    }
    return {
        n: {
            t: getStateMgr_NS(b),
            f: getStateMgr_NS(b).ARStateChange,
            a: [b, 4]
        }
    }
}
function FormAction_NewRequest(b) {
    HidePromptBar();
    return {
        n: {
            t: getStateMgr_NS(b),
            f: getStateMgr_NS(b).ARStateChange,
            a: [b, 1]
        }
    }
}
function FormAction_NewDialog(b) {
    return {
        n: {
            t: getStateMgr_NS(b),
            f: getStateMgr_NS(b).ARStateChange,
            a: [b, 2]
        }
    }
}
function FormAction_ShowStatusHistory(b) {
    var d = F(b, 15).G();
    if (d instanceof StatusHistoryType) {
        var f = d.GetTable();
        var g = getLocalizedMessage("Status History -- {0} ({1}) #{2}", [ARKWGetStringByIdx(b, 6), ARKWGetStringByIdx(b, 7), F(b, 1).G().toString()]);
        return {
            c: {
                f: StatusHistoryPopup,
                a: [b, g, f]
            }
        }
    }
}
function FormAction_ShowHelp(b) {
    window.open("help.html");
    WorkflowContext.WindowOpened(b)
}
function FormAction_SimulateGetEntry(b) {
    return {
        n: {
            t: getStateMgr_NS(b),
            f: getStateMgr_NS(b).ARStateChange,
            a: [b, getARStateCurrent_NS(b)]
        }
    }
}
function FormAction_OpenHomePage(b) {
    var d = allocWindowID_NS();
    weOpen(d, b, ARKWGetStringByIdx(b, 30) + "home", ("" + new Date().getTime()), "HOME", null, null, true, false);
    WorkflowContext.WindowOpened(b)
}
function FormAction_GenericApply(b) {
    if (rtfEditor != null && rtfEditor.IsVisible()) {
        rtfEditor.Close(true)
    }
    if ((getARStateCurrent_NS(b) == 1)) {
        return getCurWFC_NS(b).execute({
            f: FormAction_Submit,
            a: [b]
        })
    } else {
        if ((getARStateCurrent_NS(b) == 4)) {
            return getCurWFC_NS(b).execute({
                f: FormAction_Query,
                a: [b]
            })
        } else {
            if ((getARStateCurrent_NS(b) == 5) || (getARStateCurrent_NS(b) == 6)) {
                var f = Field_BuildList(b, new FieldList(b), true, true, false, false, true, false);
                var g = false;
                for (var d in f.mFields) {
                    g = true;
                    break
                }
                if (!g) {
                    return
                }
                return getCurWFC_NS(b).execute({
                    f: FormAction_Modify,
                    a: [b]
                })
            }
        }
    }
}
function SetupState(b) {
    var g = {
        f: FormAction_NewSearch,
        a: [b]
    };
    if (getWindowArgs_NS(b) != null && "wMode" in getWindowArgs_NS(b)) {
        g.f = getStateMgr_NS(b).OpenWindowFunctions[getStateMgr_NS(b).OpenWindowStates[getWindowArgs_NS(b).wMode][0]]
    }
    var f = getCurWFC_NS(b).execute(g);
    var h = new Date();
    return f
}
function ToggleFocusFocusToField(d) {
    var b = getForm_NS(d).LastFormFID;
    if (b == 0) {
        b = getFieldListInfo_NS(d).firstField.mID
    }
    getForm_NS(d).LastFormFID = 0;
    return new WorkflowContext(d, {
        t: FocusMgr,
        f: FocusMgr.SetFocusToField,
        a: [d, b]
    })
}
function ToggleFocusResultsList(d) {
    var f = FocusMgr.getFocusedID();
    var b;
    if (f == 1020) {
        return ToggleFocusFocusToField(d)
    } else {
        if (f == 1005) {
            return ToggleFocusAdvSearch(d)
        } else {
            if (F(d, 1020).GVis()) {
                getForm_NS(d).LastFormFID = f;
                return new WorkflowContext(d, {
                    t: FocusMgr,
                    f: FocusMgr.SetFocusToField,
                    a: [d, 1020]
                })
            }
        }
    }
}
function ToggleFocusAdvSearch(b) {
    var d = FocusMgr.getFocusedID();
    if (d == 1005) {
        ToggleFocusFocusToField(b)
    } else {
        if (F(b, 1005).GVis()) {
            getForm_NS(b).LastFormFID = d;
            return new WorkflowContext(b, {
                t: FocusMgr,
                f: FocusMgr.SetFocusToField,
                a: [b, 1005]
            })
        }
    }
}
function Form_FormActionShortcutHandler(b, d) {
    switch (d.key) {
    case 13:
        return new WorkflowContext(b, {
            f: FormAction_GenericApply,
            a: [b]
        });
    case 113:
        return new WorkflowContext(b, {
            f: FormAction_NewRequest,
            a: [b]
        });
    case 114:
        return new WorkflowContext(b, {
            f: FormAction_NewSearch,
            a: [b]
        });
    case 117:
        return ToggleFocusResultsList(b);
    case 76:
        if (getARStateCurrent_NS(b) == 1 || getARStateCurrent_NS(b) == 4) {
            return FormAction_Clear(b)
        } else {
            return
        }
    case 85:
        return new WorkflowContext(b, {
            f: FormAction_SetToDefaults,
            a: [b]
        });
    case 72:
        return new WorkflowContext(b, {
            f: FormAction_ShowStatusHistory,
            a: [b]
        });
    case 83:
        return ToggleFocusAdvSearch(b);
    default:
        return
    }
}
function traverseFields(h, d) {
    var p = 0,
    o = 0,
    b = 0;
    var k = h.mObj.childNodes[1].contentWindow.Fields;
    for (var g in k) {
        var f = k[g].mObj.className;
        if (f) {
            if (f.indexOf("AttachmentPool") != -1 || f.indexOf("TableField") != -1 || f.indexOf("TreeField") != -1 || f.indexOf("VNavBar") != -1) {
                if (d == "vertical") {
                    b = k[g].getScrollheight()
                } else {
                    b = k[g].getScrollwidth()
                }
                if (b > o) {
                    o = b
                }
            }
        }
    }
    return o
}
function LayeredModalDialog() {
    this.mStack = [];
    this.mPrev = null;
    this.mCurrentShowing = null;
    this.mFieldList = {};
    this.mLowestZIndex = nextZIndex
}
LayeredModalDialog.prototype.addToStack = function(b) {
    if (this.mFieldList[b.mID] != null) {
        return
    }
    this.mStack.push(b);
    this.mPrev = this.mCurrentShowing;
    this.mCurrentShowing = b;
    this.mFieldList[b.mID] = b;
    if (this.mStack.length == 1) {
        weDisableStuff(0)
    }
    this.Show(true);
    setTimeout(function() {
        try {
            b.mObj.focus()
        } catch(d) {}
    },
    2)
};
LayeredModalDialog.prototype.Reset = function() {
    this.mStack = [];
    this.mPrev = null;
    this.mCurrentShowing = null;
    this.mFieldList = {};
    this.mLowestZIndex = nextZIndex;
    weEnableStuff(0)
};
LayeredModalDialog.prototype.Show = function(b) {
    if (this.mCurrentShowing == null) {
        return
    }
    if (this.mPrev != null) {
        this.Hide(this.mPrev)
    }
    if ("SetDisabled" in this.mCurrentShowing) {
        this.mCurrentShowing.SetDisabled(false)
    }
    if (b == true) {
        var g = this.mCurrentShowing.mObj;
        g.style.position = "absolute";
        g.style.top = "50%";
        g.style.left = "50%";
        var f = (parseInt(g.style.height) <= 2) ? this.mCurrentShowing.mHg: parseInt(g.style.height);
        var d = (parseInt(g.style.width) <= 2) ? this.mCurrentShowing.mWd: parseInt(g.style.width);
        if (nextZIndex <= this.mLowestZIndex) {
            this.mLowestZIndex = nextZIndex
        }
        g.style.zIndex = nextZIndex++;
        this.EnableDragAndResize();
        if (typeof AnimMgr != "undefined") {
            AnimMgr.growFloatingPanel(g, f, d)
        } else {
            g.style.marginLeft = 0 - (d / 2) + "px";
            g.style.marginTop = 0 - (f / 2) + "px"
        }
    }
};
LayeredModalDialog.prototype.EnableDragAndResize = function() {
    if (this.mCurrentShowing.bHasDragHandle) {
        return
    }
    var f = this.mCurrentShowing.mObj;
    var o = f.children;
    for (var k = 0; k < o.length; k++) {
        if (o[k].id == f.id + "handle") {
            return
        }
    }
    if (this.mCurrentShowing.mResize) {
        var p = this.mCurrentShowing.mID + "handle";
        var u = document.createElement("DIV");
        u.className = "ResizeHandle  right";
        u.id = p;
        u.style.zIndex = nextZIndex++;
        f.appendChild(u);
        var q = new PopupResize(this, f.id, p, "panelresize");
        q._minX = this.mCurrentShowing.mMinWidth;
        q._minY = this.mCurrentShowing.mMinHeight
    }
    var s = document.createElement("DIV");
    var g = this.mCurrentShowing.mID + "title";
    s.id = g;
    s.style.height = "100%";
    s.className = "DraggableTitleBar DIVDraggable";
    s.innerHTML = "<img style='width:100%;height:100%' src='" + RelContextPath + "resources/images/transparent.gif'>";
    var b = f.getElementsByTagName("fieldset");
    if (this.mCurrentShowing instanceof DPage) {
        b[0].appendChild(s)
    } else {
        var d = b[0].children;
        for (var h = 0; h < d.length; h++) {
            if (d[h].className == "PageBody") {
                d[h].appendChild(s);
                break
            }
        }
    }
    var v = new PopUpDrag(this, f.id, "paneldrag");
    v.setOuterHandleElId(g);
    if (this.mCurrentShowing.mResize) {
        v.addInvalidHandleId(p)
    }
    ddGlobal = v;
    this.mCurrentShowing.bHasDragHandle = true
};
LayeredModalDialog.prototype.Hide = function(b) {
    if ("SetDisabled" in b) {
        b.SetDisabled(true)
    }
};
LayeredModalDialog.prototype.removeFromStack = function(d) {
    if (this.mFieldList[d.mID] == null) {
        return
    }
    if (d.mID == this.mCurrentShowing.mID) {
        this.mStack.pop()
    } else {
        for (var b = 0; b < this.mStack.length; b++) {
            var g = this.mStack[b];
            if (g.mID != d.mID) {
                continue
            }
            this.mStack.splice(b, 1);
            if ("SetDisabled" in g) {
                g.SetDisabled(false)
            }
        }
        if (this.mPrev.mID == d.mID) {
            if (this.mStack.length - 1 > 0) {
                this.mPrev = this.mStack[this.mStack.length - 2]
            }
        }
    }
    this.mFieldList[d.mID] = null;
    delete this.mFieldList[d.mID];
    this.mPrev = null;
    this.mCurrentShowing = null;
    if (this.mStack.length > 0) {
        this.mCurrentShowing = this.mStack[this.mStack.length - 1]
    }
    if (this.mStack.length - 1 > 0) {
        this.mPrev = this.mStack[this.mStack.length - 2]
    }
    this.Show(false);
    if (this.mCurrentShowing != null) {
        var f = this.mCurrentShowing;
        setTimeout(function() {
            try {
                f.mObj.focus()
            } catch(h) {}
        },
        2)
    }
    if (this.mStack.length == 0) {
        weEnableStuff(0);
        FocusMgr.resettheFocus()
    }
};
LayeredModalDialog.prototype.OnResize = function(f, g, d, b) {
    if ((f != g || d != b)) {
        var h = this.mCurrentShowing;
        if (h instanceof DPage && h.mFillModel == null) {
            return
        }
        setTimeout(function() {
            h.ResizeTo(g, b)
        },
        5)
    }
};
LayeredModalDialog.prototype.OnStartDrag = function() {
    if (this.mCurrentShowing instanceof DPageHolder) {
        if (this.mCurrentShowing.mViewTypeObj instanceof StackView) {
            this.mCurrentShowing.mViewTypeObj.mRelPosContainer.style.overflowY = "hidden"
        }
    }
};
LayeredModalDialog.prototype.OnEndDrag = function() {
    if (this.mCurrentShowing instanceof DPageHolder) {
        if (this.mCurrentShowing.mViewTypeObj instanceof StackView) {
            this.mCurrentShowing.mViewTypeObj.mRelPosContainer.style.overflowY = "auto"
        }
    }
};
LayeredModalDialog.prototype.PanelDialogVisible = function() {
    return this.mCurrentShowing != null
};
var formModalList = new LayeredModalDialog();
function ToolTipDialogManager() {
    this.mFields = []
}
ToolTipDialogManager.prototype.show = function(b) {
    if (this.mFields.length == 0) {
        this.mPrimary = b
    }
    b.mDisplay = false;
    b.showTT();
    this.mFields.push(b)
};
ToolTipDialogManager.prototype.dismiss = function(d) {
    if (this.mFields.length > 0) {
        var b = [];
        var h = null;
        for (var g = this.mFields.length - 1; g >= 0; g--) {
            if (!this.mFields[g].EvtInside(d)) {
                if (this.mFields[g].mChild != null) {
                    if (h != this.mFields[g].mChild) {
                        b.push(this.mFields[g])
                    }
                } else {
                    b.push(this.mFields[g])
                }
            } else {
                h = this.mFields[g]
            }
        }
        if (b.length > 0) {
            for (g = 0; g < b.length; g++) {
                b[g].reset();
                RTF_Close(true);
                for (var f = 0; f < this.mFields.length; f++) {
                    if ((this.mFields[f] != null) && this.mFields[f].mID == b[g].mID) {
                        this.mFields[f] = null;
                        this.mFields.splice(f, 1)
                    }
                }
            }
            b = []
        }
    }
};
ToolTipDialogManager.prototype.EscapeTooltip = function() {
    if (this.mFields.length == 0) {
        return true
    }
    gTTEscScrollposX = getFormElements_NS(0)["FormContainer"].scrollLeft;
    gTTEscScrollposY = getFormElements_NS(0)["FormContainer"].scrollTop;
    FocusMgr.resettheFocus();
    if (this.mFields.length > 0) {
        for (var b = 0; b < this.mFields.length; b++) {
            this.mFields[b].reset()
        }
    }
    return false
};
var formTTList = new ToolTipDialogManager();
function ValidateTTPanel() {
    if (formTTList.mFields.length > 0) {
        return true
    } else {
        return false
    }
}
function EscapeTTPanel() {
    FocusMgr.resettheFocus();
    return formTTList.EscapeTooltip()
}
var gTTEscScrollposX = 0;
var gTTEscScrollposY = 0;
function SetupHandlers() {
    getFormElements_NS(0)["FormContainer"].onscroll = FormEvent.Trampoline(function(b) {
        Menu_Close();
        if (rtfEditor != null && rtfEditor.mEditing != null) {
            rtfEditor.UpdatePos()
        }
        if ((gTTEscScrollposX != undefined && gTTEscScrollposX != 0) || (gTTEscScrollposY != undefined && gTTEscScrollposY != 0)) {
            getFormElements_NS(0)["FormContainer"].scrollLeft = gTTEscScrollposX;
            getFormElements_NS(0)["FormContainer"].scrollTop = gTTEscScrollposY;
            gTTEscScrollposX = 0;
            gTTEscScrollposY = 0
        }
    });
    document.body.onmouseover = FormEvent.Trampoline(function(b) {
        MidTierDragDropMgrInst.lastMouseOverElement = b.element;
        if (b.element && b.element.className.indexOf("prompt") == 0) {
            promptBar.DOMMouseOver(b)
        } else {
            if (!window.weDialogueName) {
                if (Menu_DispatchEvent(1, b)) {
                    return false
                }
                var d = Field_FromElement(b.element);
                if (d) {
                    d.DOMMouseOver(b)
                }
            }
        }
        return true
    });
    document.body.onmousemove = FormEvent.Trampoline(function(b) {
        MidTierDragDropMgrInst.lastMouseOverElement = b.element;
        if (!window.weDialogueName) {
            var d = Field_FromElement(b.element);
            if (d) {
                d.DOMMouseMove(b)
            }
        }
        return true
    });
    document.body.onmousedown = FormEvent.Trampoline(function(g) {
        var d = Window_FromElement(g.element);
        FormEvent.lastMouseDownEvent = g;
        if (!wePuntFocus(d)) {
            if (Menu_DispatchEvent(2, g)) {
                return false
            }
            if (WDEHandleEvent(0, g)) {
                return false
            }
            var b = g.element;
            if (b = FakeButton_Find(b)) {
                if (FakeButton_Disabled(b)) {
                    return false
                }
                FakeButton_MouseDown(b)
            }
            var h = Field_FromElement(g.element);
            if (h) {
                if (h.TracksCaret) {
                    h.TrackCaret(g.element)
                }
                promptBar.setToClear();
                new WorkflowContext(h.windowID, {
                    f: function() {
                        var f = {};
                        if (g.element.tagName == "INPUT" || g.element.tagName == "TEXTAREA" || g.element.tagName == "LABEL" || (g.element.tagName == "DIV" && (g.element.className.indexOf("text") != -1 || g.element.className.indexOf("DivEditor") != -1))) {
                            hoverState.wfMouseDown();
                            f.c = {
                                t: FocusMgr,
                                f: FocusMgr.HandleFocusEvt,
                                a: [h.windowID, g]
                            }
                        }
                        f.n = {
                            t: h,
                            f: h.DOMMouseDown,
                            a: [g]
                        };
                        return f
                    }
                })
            }
        }
        return true
    });
    document.body.onmouseup = FormEvent.Trampoline(function(g) {
        var d = Window_FromElement(g.element);
        MidTierDragDropMgrInst.lastMouseUpElement = g.element;
        if (!wePuntFocus(d)) {
            if (Menu_DispatchEvent(3, g)) {
                return false
            }
            if (WDEHandleEvent(1, g)) {
                return false
            }
            var b = g.element;
            if (b = FakeButton_Find(b)) {
                if (FakeButton_Disabled(b)) {
                    return false
                }
                FakeButton_MouseUpOut(b)
            }
            var h = Field_FromElement(g.element);
            if (h) {
                if (h.TracksCaret) {
                    h.TrackCaret(g.element)
                }
                new WorkflowContext(h.windowID, {
                    f: function() {
                        var f = {};
                        f.c = {
                            t: h,
                            f: h.DOMMouseUp,
                            a: [g]
                        };
                        f.n = {
                            f: function() {
                                if (g.element.tagName == "INPUT" || g.element.tagName == "TEXTAREA" || g.element.tagName == "LABEL") {
                                    hoverState.wfMouseUp()
                                }
                            }
                        };
                        return f
                    }
                })
            }
        }
        return true
    });
    document.body.onmouseout = FormEvent.Trampoline(function(d) {
        if (d.element.className.indexOf("prompt") == 0) {
            promptBar.DOMMouseOut(d)
        } else {
            if (!window.weDialogueName) {
                var b = d.element;
                if (b = FakeButton_Find(b)) {
                    if (FakeButton_Disabled(b)) {
                        return false
                    }
                    FakeButton_MouseUpOut(b)
                }
                var g = Field_FromElement(d.element);
                if (g) {
                    g.DOMMouseOut(d)
                }
            }
        }
        return true
    });
    document.body.onkeydown = FormEvent.Trampoline(function(g) {
        var d = Window_FromElement(g.element);
        if (!wePuntFocus(d)) {
            var b = g.element;
            var o = DIVPopup.FindPopup(d, b);
            if (o) {
                return o.KeyDown(g)
            }
            if (Menu_DispatchEvent(4, g)) {
                return false
            }
            if (WDEHandleEvent(3, g)) {
                return false
            }
            if (g.alt && g.ctrl) {
                return Form_FormActionShortcutHandler(d, g)
            }
            if (g.ctrl && g.shift && g.key == 36) {
                FocusMgr.SetFocusToFirst(d)
            }
            if (g.ctrl && g.shift && g.key == 35) {
                FocusMgr.SetFocusToLast(d)
            }
            if (g.alt && (g.key == 120 || g.key == 121 || g.key == 123)) {
                return hoverState.hoverByKey(g)
            }
            if (g.key == 9) {
                var k;
                hoverState.wfTabStart();
                if (g.shift) {
                    k = FocusMgr.SetFocusToPrevious(g)
                } else {
                    k = FocusMgr.SetFocusToNext(g)
                }
                hoverState.wfTabEnd();
                if (k) {
                    g.SetKeyCode(505);
                    return false
                }
                return true
            }
            if (g.key == 27) {
                if (!EscapeTooltip() || !EscapeTTPanel()) {
                    g.StopBubbling();
                    g.StopDefault();
                    return false
                }
            }
            if (b = FakeButton_Find(b)) {
                if (FakeButton_Disabled(b)) {
                    return false
                }
            }
            var h = Field_FromElement(g.element);
            if (h) {
                if (g.ctrl && g.key == 86) {
                    return h.FieldValChanged(g)
                }
                promptBar.setToClear();
                new WorkflowContext(h.windowID, {
                    t: h,
                    f: h.DOMKeyDown,
                    a: [g]
                });
                if (g.mStoppedDefault == true) {
                    g.SetKeyCode(505);
                    return false
                }
            }
        }
        return true
    });
    document.body.onkeyup = FormEvent.Trampoline(function(b) {
        var d = Field_FromElement(b.element);
        if (d) {
            d.FieldValChanged(b);
            if (d.TracksCaret) {
                d.TrackCaret(b.element)
            }
            new WorkflowContext(d.windowID, {
                t: d,
                f: d.DOMKeyUp,
                a: [b]
            })
        }
    });
    document.body.onpaste = FormEvent.Trampoline(function(b) {
        var d = Field_FromElement(b.element);
        if (d) {
            setTimeout(function() {
                if (d.mDataType == 4) {
                    checkPasteLength(b.element, d.mMaxLen, d.mID)
                }
                d.FieldValChanged(b)
            },
            0)
        }
    });
    document.body.onselectstart = FormEvent.Trampoline(function(b) {
        var d = Field_FromElement(b.element);
        if (d) {
            if (d.TracksCaret) {
                d.TrackCaret(b.element)
            }
            return d.IsMouseSelectable(b.element)
        }
        return true
    });
    document.body.onclick = FormEvent.Trampoline(function(k) {
        if (curClickElement != null) {
            k.element = curClickElement.ele;
            k.mMouseX = curClickElement.screenX;
            k.mMouseY = curClickElement.screenY;
            curClickElement = null
        }
        var d = Window_FromElement(k.element);
        if (TTisDisplayed()) {
            if (TTCloseByClick()) {
                var p = TTNotifyClick(k);
                switch (p) {
                case 0:
                    k.StopBubbling();
                    k.StopDefault();
                    return false;
                    break;
                case 3:
                    return true;
                    break;
                case 1:
                    break
                }
            }
        }
        if (ValidateTTPanel()) {
            formTTList.dismiss(k)
        }
        if (k.element.className.indexOf("prompt") == 0) {
            return promptBar.DOMClick(k)
        }
        var q = false;
        var b = false;
        if (!wePuntFocus(d)) {
            var h = k.element;
            var g = DIVPopup.FindPopup(d, h);
            if (g) {
                return g.Click(k)
            }
            if (Menu_DispatchEvent(0, k)) {
                return false
            }
            if (h = FakeButton_Find(h)) {
                if (FakeButton_Disabled(h)) {
                    return false
                }
                q = true
            }
            var o = Field_FromElement(k.element);
            if (o) {
                if (h == null && k.element && o.isRTF && o.isRTF()) {
                    if (k.element.tagName == "A" || (k.element.tagName == "IMG" && k.element.parentNode && k.element.parentNode.tagName == "A")) {
                        return true
                    }
                }
                if (o.TracksCaret) {
                    o.TrackCaret(k.element)
                }
                var s = o.windowID;
                new WorkflowContext(s, {
                    f: function() {
                        var f = {};
                        if (! (k.element.tagName == "INPUT" || k.element.tagName == "TEXTAREA" || (k.element.tagName == "DIV" && (k.element.className.indexOf("text") != -1 || k.element.className.indexOf("DivEditor") != -1))) || ("isRTF" in o && o.isRTF() && (k.element.tagName == "DIV" && k.element.className.indexOf("text") != -1))) {
                            f.c = {
                                t: FocusMgr,
                                f: FocusMgr.HandleFocusEvt,
                                a: [s, k]
                            }
                        }
                        f.n = {
                            f: function() {
                                if (o.GetFocusElementForEvent(k) != null) {
                                    return {
                                        c: {
                                            t: o,
                                            f: o.DOMClick,
                                            a: [k]
                                        }
                                    }
                                } else {
                                    if (o.IsLabelPart(k.element)) {
                                        if (1005 in getFields_NS(s) && F(s, 1005).GVis()) {
                                            if (k.element.className.indexOf("do") != -1 && (parseInt(k.element.parentNode.getAttribute("arid")) != 178)) {
                                                var v = new AlertPopup(s);
                                                var u = k.element.innerHTML + getLocalizedMessage(" is a display only field.");
                                                v.SetContents(getLocalizedMessage("Error"), u);
                                                v.ShowCentredPopup(false)
                                            } else {
                                                F(s, 1005).InsertAtCaret("'" + o.GLabelOrID().ARQualifierEncode() + "'")
                                            }
                                        }
                                        k.StopBubbling();
                                        k.StopDefault()
                                    } else {
                                        if (o.GAccess() == 3) {
                                            if (k.element.type == "radio" && k.element.name != null && k.element.name != "undefined") {
                                                dradiobutt = document.getElementsByName(k.element.name);
                                                if (k.element.disabledindex != null && k.element.disabledindex < dradiobutt.length) {
                                                    dradiobutt[k.element.disabledindex].checked = true
                                                }
                                                if (k.element.disabledindex == null || k.element.disabledindex == "undefined") {
                                                    for (i = 0; i < dradiobutt.length; i++) {
                                                        dradiobutt[i].checked = false
                                                    }
                                                }
                                                k.element.disabledindex = null
                                            }
                                            k.StopDefault()
                                        }
                                    }
                                }
                            }
                        };
                        return f
                    }
                })
            } else {
                if (q && "Toolbar_Click" in window) {
                    new WorkflowContext(d, {
                        f: Toolbar_Click,
                        a: [d, k]
                    })
                }
            }
        }
        return ! (q | b)
    });
    document.body.ondblclick = FormEvent.Trampoline(function(g) {
        var d = Window_FromElement(g.element);
        if (!wePuntFocus(d)) {
            var b = g.element;
            if (b = FakeButton_Find(b)) {
                if (FakeButton_Disabled(b)) {
                    return false
                }
            }
            var h = Field_FromElement(g.element);
            if (h) {
                if (h.TracksCaret) {
                    h.TrackCaret(g.element)
                }
                if (h.GetFocusElementForEvent(g) != null) {
                    promptBar.setToClear();
                    new WorkflowContext(h.windowID, {
                        t: h,
                        f: h.DOMDoubleClick,
                        a: [g]
                    })
                }
                h.FieldValChanged(g)
            }
        }
        return true
    });
    document.body.onkeypress = FormEvent.Trampoline(function(g) {
        var d = Window_FromElement(g.element);
        if (!wePuntFocus(d)) {
            var b = g.element;
            var o = DIVPopup.FindPopup(d, b);
            if (o) {
                return o.KeyPress(g)
            }
            if (g.alt && g.ctrl) {
                return Form_FormActionShortcutHandler(d, g)
            }
            var k = Field_FromElement(g.element);
            if (k) {
                if ((g.key == 13) || (g.key == 32)) {
                    if (b = FakeButton_Find(b)) {
                        if (FakeButton_Disabled(b)) {
                            return false
                        }
                        FakeButton_MouseDown(b);
                        setTimeout(function() {
                            FakeButton_MouseUpOut(b)
                        },
                        250);
                        var h = {
                            t: k,
                            f: k.DOMClick,
                            a: [g]
                        };
                        new WorkflowContext(k.windowID, h);
                        return false
                    }
                }
                promptBar.setToClear();
                var h = {
                    t: k,
                    f: k.DOMKeyPress,
                    a: [g]
                };
                new WorkflowContext(k.windowID, h)
            }
        }
        return true
    });
    document.oncontextmenu = FormEvent.Trampoline(function(d) {
        var b = Window_FromElement(d.element);
        if (!wePuntFocus(b)) {
            var g = Field_FromElement(d.element);
            if (g && g.hasContextMenu) {
                new WorkflowContext(g.windowID, {
                    t: g,
                    f: g.DOMContextMenu,
                    a: [d]
                });
                return false
            }
        }
        return true
    });
    window.onfocus = FormEvent.Trampoline(function(d) {
        var b = Window_FromElement(d.element);
        if (!wePuntFocus(b)) {
            if (FocusMgr) {
                FocusMgr.WindowGotFocus(b)
            }
            if (checkCookiesToLoad()) {
                loadCookie("GF")
            }
            FieldList.SetAllGlobals(b)
        }
        return true
    });
    window.onresize = FormEvent.Trampoline(function(d) {
        var b = Window_FromElement(d.element);
        if (window.ARInitPane == undefined) {
            Menu_Close();
            resizeWindow = true;
            FormPane.Layout(b);
            resizeWindow = false
        }
        return true
    });
    window.onbeforeunload = FormEvent.Trampoline(function(f) {
        var d = getCurrentWindowID_NS();
        if (!globalLogout) {
            Menu_Close();
            var b = {};
            new WorkflowContext(d, {
                t: getStateMgr_NS(d),
                f: getStateMgr_NS(d).WindowIsClosing,
                a: [b]
            });
            if (b.ab) {
                getStateMgr_NS(d).mWindowIsClosed = false;
                return getLocalizedMessage("One or more active links failed when closing the form.  Close this form anyway?", null)
            } else {
                if (((getARStateCurrent_NS(d) == 5) || ((getARStateCurrent_NS(d) == 1) && getStateMgr_NS(d).IsSaveAllowed(d))) && Field_GetChanged(d)) {
                    getStateMgr_NS(d).mWindowIsClosed = false;
                    return getLocalizedMessage("Your changes have not been saved or sent.  Do you really want to close the window?", null)
                } else {
                    getStateMgr_NS(d).ClearSnapshot();
                    weOnUnload(d);
                    Field_Unload(d)
                }
            }
        }
    })
}
function checkCookiesToLoad() {
    var f = getMaxCookieDateValue();
    var b = wm.lasttimeCookieUpdated;
    var d = false;
    if (b == null && f != null) {
        d = true
    } else {
        if (b != null && f != null && f > b) {
            d = true
        }
    }
    if (d) {
        wm.lasttimeCookieUpdated = f
    }
    return d
}
function getMaxCookieDateValue() {
    var f = window;
    var b = wm.lasttimeCookieUpdated;
    try {
        while (f.opener != null && f.opener != "undefined" && !f.opener.closed) {
            f = f.opener
        }
        return findChildWindowMaxCookieUpdatedValue(f, f.wm.lasttimeCookieUpdated)
    } catch(d) {
        return false
    }
}
function findChildWindowMaxCookieUpdatedValue(f, d) {
    var g = f.getChildWindowIDs(f.wm.topWinWindowID);
    for (i in g) {
        if (typeof g[i].windowID != "undefined" && g[i].windowID != null && typeof g[i].windowObj.wm == "object") {
            var b = g[i].windowObj.wm.lasttimeCookieUpdated;
            if (d == null) {
                d = b
            }
            if (d != null && b != null && d < b) {
                d = b
            }
            d = findChildWindowMaxCookieUpdatedValue(g[i].windowObj, d)
        }
    }
    return d
}
function Form_UpdateToolbar(d) {
    if (getToolBarPane_NS(d)) {
        var b = getFormElements_NS(d)["Toolbar"];
        NodeWrite(b.firstChild.childNodes[1], getStateMgr_NS(d).GetToolbarTitle())
    }
    if (getQBPane_NS(d) != null) {
        if ((getARStateCurrent_NS(d) == 4)) {
            F(d, 1005).SVis(F(d, 1005).mKeepOpen || ARPrefsGetAsNumber(23203) > 0)
        } else {
            F(d, 1005).SVis(false)
        }
    }
}
function ShowToolbar(d, f) {
    var b = getToolBarPane_NS(d);
    if (b) {
        b.SVis(f);
        b.mObj.style.visibility = (f) ? "": "hidden";
        FormPane.Layout(d)
    }
}
function ShowResultsListPane(b) {
    getResultsListPane_NS(b).SVis(true);
    getSplitterPane_NS(b).SVis(true);
    FormPane.Layout(b);
    getForm_NS(b).LastFormFID = 0
}
function HideResultsListPane(b) {
    getResultsListPane_NS(b).SVis(false);
    getSplitterPane_NS(b).SVis(false);
    FormPane.Layout(b)
}
function HidePromptBar() {
    promptBar.hide(false)
}
function formDisableStuff(b) {
    if (getOpenDIVPopup_NS(b) && getOpenDIVPopup_NS(b).mModal) {
        return
    }
    if (window.weDisabledObj) {
        return
    }
    var d = getFormElements_NS(b)["FormContainer"];
    var f = window.document.createElement("DIV");
    f.className = "BlankOutForm";
    d.appendChild(f);
    d.formDisabledObj = f
}
function formEnableStuff(b) {
    if (getOpenDIVPopup_NS(b) && getOpenDIVPopup_NS(b).mModal) {
        return
    }
    var d = getFormElements_NS(b)["FormContainer"];
    if (d.formDisabledObj) {
        d.removeChild(d.formDisabledObj);
        d.formDisabledObj = null
    }
}
function WorkflowException(d, g, b) {
    this.windowID = d;
    if (arguments.length == 2 && g >= 0 && b instanceof Array && b.length > 0) {
        if (! ("msgloc" in b[0])) {
            var h = [];
            for (var f = 0; f < b.length; f++) {
                var k = promptBar.msgDestination(b[f].t, false, null);
                h.push({
                    mstat: b[f],
                    msgloc: k
                })
            }
            this.mArg = h
        } else {
            this.mArg = b
        }
    } else {
        this.mArg = b
    }
    this.mCode = g;
    if (g < 0) {
        LogWrite("WorkflowException: " + g)
    }
}
WorkflowException.prototype.getStatus = function() {
    var b = [];
    for (var d = 0; d < this.mArg.length; d++) {
        b.push(this.mArg[d].mstat)
    }
    return b
};
WorkflowException.prototype.getLStatus = function() {
    return this.mArg
};
WorkflowException.prototype.getCode = function() {
    return this.mCode
};
WorkflowException.prototype.hasMessages = function() {
    if (this.mArg && this.mArg instanceof Array && this.mArg.length > 0) {
        return true
    } else {
        return false
    }
};
WorkflowException.prototype.isNumValue = function() {
    if (this.mArg) {
        return typeof this.mArg == "number"
    } else {
        false
    }
};
WorkflowException.prototype.getNumValue = function() {
    if (this.isNumValue()) {
        return this.mArg
    } else {
        return null
    }
};
WorkflowException.prototype.toString = function() {
    if (typeof this.mArg == "number") {
        return "Non-translated, non-formatted AR Error: " + this.mArg
    }
    if (typeof this.mArg == "undefined") {
        return ""
    }
    return WorkflowContext_StatusToString(this.windowID, this.getStatus())
};
String.prototype.trim = function(b, g) {
    var f = this.toString();
    if (b & 1) {
        f = f.replace((g ? (/^[ \t]+/) : (/^\s+/)), "")
    }
    if (b & 2) {
        var h = (g ? (/[^ \t]/) : (/\S/));
        for (var d = f.length - 1; d >= 0; d--) {
            if (h.test(f.charAt(d))) {
                f = f.substring(0, d + 1);
                break
            }
        }
        if (d == -1) {
            f = ""
        }
    }
    return f
};
String.prototype.compareString = function(h) {
    var d = this.length;
    var b = h.length;
    var g = Math.min(d, b);
    for (var f = 0; f < g; f++) {
        if (this.charCodeAt(f) > h.charCodeAt(f)) {
            return 1
        } else {
            if (this.charCodeAt(f) < h.charCodeAt(f)) {
                return - 1
            }
        }
    }
    if (d > b) {
        return 1
    } else {
        if (d < b) {
            return - 1
        }
    }
    return 0
};
String.prototype.localeCompare = String.prototype.compareString;
String.prototype.isDigits = function() {
    return (this.match(/[0-9]+/) != null)
};
String.prototype.isNumeric = function() {
    return (this.match(/^[\d]+$/) != null)
};
String.prototype.replaceArgs = function() {
    var b = arguments;
    return this.replace(/\{(\d+)\}/g,
    function(d, f) {
        return b[f]
    })
};
var REGEXPSPECIALCHARS = /([\.\*\?\+\[\]\(\)\{\}\^\$\|\\])/g;
String.prototype.toRegExp = function() {
    return this.replace(REGEXPSPECIALCHARS, "\\$1")
};
String.prototype.HTMLEncode = function() {
    return this.replace(/(<)|(>)|(\")|(&)/gim,
    function(b, h, g, f, d) {
        if (h) {
            return "&lt;"
        }
        if (g) {
            return "&gt;"
        }
        if (f) {
            return "&quot;"
        }
        if (d) {
            return "&amp;"
        }
    })
};
String.prototype.HTMLDecode = function() {
    return this.replace(/(&lt;)|(&gt;)|(&quot;)|(&amp;)/gim,
    function(b, h, g, f, d) {
        if (h) {
            return "<"
        }
        if (g) {
            return ">"
        }
        if (f) {
            return '"'
        }
        if (d) {
            return "&"
        }
    })
};
String.prototype.ValidatorUnEscape = function() {
    return this.replace(/(&#37;)|(&#59;)|(&#40;)|(&#41;)|(&#43;)/gim,
    function(b, k, h, g, f, d) {
        if (k) {
            return "%"
        }
        if (h) {
            return ";"
        }
        if (g) {
            return "("
        }
        if (f) {
            return ")"
        }
        if (d) {
            return "+"
        }
    })
};
String.prototype.ValidatorEscape = function() {
    return this.replace(/(%)|(;)|(\()|(\))|(\+)/gim,
    function(b, k, h, g, f, d) {
        if (k) {
            return "&#37;"
        }
        if (h) {
            return "&#59;"
        }
        if (g) {
            return "&#40;"
        }
        if (f) {
            return "&#41;"
        }
        if (d) {
            return "&#43;"
        }
    })
};
String.prototype.JScriptEncode = function() {
    return this.replace(/(\")|(\n)|(\r)|(\\)/gim,
    function(b, h, g, f, d) {
        if (h) {
            return '\\"'
        }
        if (g) {
            return "\\n"
        }
        if (f) {
            return "\\r"
        }
        if (d) {
            return "\\\\"
        }
    })
};
String.prototype.JScriptFlexEncode = function() {
    return this.replace(/(\")|(\\)/gim,
    function(b, f, d) {
        if (f) {
            return f
        }
        if (d) {
            return "\\\\"
        }
    })
};
String.prototype.ARQualifierEncode = function() {
    return this.replace(/(')/gim,
    function(b, d) {
        if (d) {
            return "''"
        }
    })
};
String.prototype.EscapeQuote = function() {
    return this.replace(/(')/gim,
    function(b, d) {
        if (d) {
            return "\\'"
        }
    })
};
String.prototype.ConvertCarriageReturn = function() {
    return this.replace(/(\r\n)|(\n)/gim,
    function(b, f, d) {
        if (f) {
            return f
        }
        if (d) {
            return "\r\n"
        }
    })
};
String.prototype.ARToJSIdentifier = function() {
    return this.replace(/[^A-Za-z0-9]/g,
    function(b) {
        return "_" + b.charCodeAt(0)
    })
};
String.prototype.compareToIgnoreCase = function(b) {
    return this.toLowerCase() == b.toLowerCase()
};
String.NBSP = new RegExp(String.fromCharCode(160), "g");
String.prototype.replaceNBSP = function() {
    return this.replace(String.NBSP, " ")
};
String.fromCharCodeWithNumPad = function(b) {
    if (b >= 96 && b <= 105) {
        b = b - (96 - 48)
    }
    return String.fromCharCode(b)
};
function addWindowAsChild(h, d, f, g, b) {
    new weWindow(h, d, f, g, b)
}
function weWindow(k, d, f, g, b) {
    var h = makeweChildName(k, f);
    this.mWin = k;
    this.mArg = d;
    this.mName = f;
    this.mType = g;
    this.mContinuation = b;
    this.mArrived = false
}
function weDeepCopy(b, f) {
    for (var d in f) {
        if (typeof f[d] == "number" || typeof f[d] == "boolean") {
            b[d] = f[d]
        } else {
            if (typeof f[d] == "string") {
                b[d] = new String(f[d])
            } else {
                if (typeof f[d] == "object") {
                    b[d] = {};
                    weDeepCopy(b[d], f[d])
                } else {
                    LogAndAlert("Unknown type " + typeof d)
                }
            }
        }
    }
}
function weDeepSerialise(o, g) {
    var d = o instanceof Array;
    g.push(d ? "[": "{");
    var k = true;
    for (var f in o) {
        var b = typeof o[f];
        if (b == "undefined") {
            continue
        }
        if (!k) {
            g.push(",")
        }
        if (!d) {
            g.push(f + ":")
        }
        if (b == "number" || b == "boolean") {
            g.push(o[f])
        } else {
            if (b == "string") {
                var h = o[f].JScriptEncode();
                g.push('"' + h + '"')
            } else {
                if (b == "object") {
                    if (o[f] != null) {
                        weDeepSerialise(o[f], g)
                    } else {
                        g.push(o[f] + "")
                    }
                } else {}
            }
        }
        k = false
    }
    g.push(d ? "]": "}")
}
function weDeepSerialiseVariable(b) {
    var d = [];
    weDeepSerialise(b, d);
    return d.join("")
}
function weGetARWindowOpener() {
    var d = window.opener;
    try {
        if (d == null && parent != null && parent.name != window.name) {
            d = parent
        }
        while (d != null) {
            if (("quickReportParamURL" in d) || ("menubox" in d)) {
                break
            }
            if (d.parent != null && d.name != d.parent.name) {
                d = d.parent;
                continue
            }
            d = d.opener
        }
        if (d == null) {
            d = window.opener
        }
    } catch(b) {}
    return d
}
function weOnLoad(b) {
    window.weDialogueName = null;
    if (window.name == "" && window.frameElement && window.frameElement.id) {
        window.name = window.frameElement.id;
        setWindowName_NS(b, window.name)
    }
    if (!window.weOpener) {
        if (window.opener && !window.opener.closed) {
            window.weOpener = weGetARWindowOpener()
        } else {
            window.weOpener = null
        }
    }
    try {
        if (window.weOpener && !window.weOpener.closed && window.name == window.weOpener.name) {
            window.opener = null;
            window.weOpener = null
        }
    } catch(g) {
        window.opener = null;
        window.weOpener = null
    }
    try {
        if (window.weOpener == null && parent != null && "ARProcessEvent" in parent && parent.name != window.name) {
            window.weOpener = parent
        }
    } catch(g) {}
    if (window.weOpener && !window.weOpener.closed && window.name != "") {
        if (window.weOpener && !window.weOpener.closed && window.weOpener.window.weChildCome) {
            window.weOpener.window.weChildCome(window, window.name, window.arWindowType);
            window.arWindowType = window.weOpener.window.weExtractWindowType(window, window.name);
            setWindowType(b, window.arWindowType);
            setWindowArgs_NS(b, window.weOpener.window.weExtractArgs(window, window.name))
        }
    } else {
        if (window.name == "") {
            setWindowArgs_NS(b, null);
            window.name = createARRootWindowName();
            setWindowName_NS(b, window.name)
        }
    }
    if (window.URLParams) {
        if ("eid" in window.URLParams) {
            if (!getWindowArgs_NS(b)) {
                setWindowArgs_NS(b, {})
            }
            getWindowArgs_NS(b).eid = window.URLParams.eid
        }
        if ("qual" in window.URLParams) {
            if (!getWindowArgs_NS(b)) {
                setWindowArgs_NS(b, {})
            }
            try {
                var f = new NDXParseAndEncodeQualifier(b, ARKWGetByName(b, "SERVER").toString(), ARKWGetByName(b, "SCHEMA").toString(), ARKWGetByName(b, "VUI").toString(), window.URLParams.qual).result;
                getWindowArgs_NS(b).qual = {
                    qual: f,
                    fieldids: [],
                    fieldvals: [],
                    fieldtypes: []
                }
            } catch(d) {
                LogAndAlert(d)
            }
        }
        if ("mode" in window.URLParams) {
            if (!getWindowArgs_NS(b)) {
                setWindowArgs_NS(b, {})
            }
            getWindowArgs_NS(b).wMode = (window.URLParams.mode.compareToIgnoreCase("submit") || window.URLParams.mode.compareToIgnoreCase("create")) ? 2 : (window.URLParams.mode.compareToIgnoreCase("modifyDirect") ? 12 : 1)
        }
    }
    try {
        if (weAmPopup(window.name) && (getWindowArgs_NS(b) && getWindowArgs_NS(b).title != getLocalizedMessage("Add Attachment"))) {
            window.setTimeout(function() {
                if (typeof FormContainer != "undefined") {
                    if ("external" in window.weOpener) {
                        try {
                            if (typeof loaded != "undefined") {
                                loaded++
                            }
                            if ("external" in top) {
                                top.external.PopupFormLoaded()
                            } else {
                                window.weOpener.external.PopupFormLoaded()
                            }
                        } catch(h) {}
                    }
                    return
                }
                if ("external" in window.weOpener) {
                    try {
                        if (typeof loaded != "undefined") {
                            loaded++
                        }
                        if ("external" in top) {
                            top.external.PopupLoaded(b)
                        } else {
                            window.weOpener.external.PopupLoaded(b)
                        }
                    } catch(h) {}
                }
            },
            100)
        } else {
            if ("external" in top) {
                try {
                    if (typeof loaded != "undefined") {
                        loaded++
                    }
                    top.external.FormLoaded(b)
                } catch(g) {}
            }
        }
    } catch(g) {}
}
window.weAddChildWindow = function(g, f, d, h, b, o, k) {
    setWindowArgs_NS(g, b);
    var p = makeweChildNameUsingParent(k, d);
    setChildWindowIDForName(p, g);
    setWindowType(g, h);
    setcontinuationFuncs_NS(g, null);
    setOpenerWindowID(g, f, k);
    addChildWindowID(f, g, o)
};
window.weOpen = function(h, f, b, s, k, y, w, g, u) {
    initSessionTimeoutCounter();
    if (weAmDialogue(window.name)) {
        if (window.weOpener && !window.weOpener.closed && window.weOpener.window.weOpen) {
            var v = window.weOpener.window.getTopWinWindowID_NS()
        }
        var d = window.weOpener.window.allocWindowID_NS();
        if (flashInit) {
            var q = getGlobalFields();
            window.weOpener.setProxyGlobalFields(q)
        }
        return window.weOpener.window.weOpen(d, v, b, s, k, y, w, g, u);
        return null
    }
    setWindowMode(h, "");
    setWindowType(h, k);
    setWindowArgs_NS(h, y);
    var p = makeweChildNameUsingParent(window, s);
    setChildWindowIDForName(p, h);
    setOpenerWindowID(h, f, window);
    setChildArrived_NS(h, false);
    var o = null;
    if (g) {
        o = window.open(b, s, (w ? (",width=" + w[0] + ",height=" + w[1]) : ""))
    } else {
        o = window.open(b, s, ((w ? (",width=" + w[0] + ",height=" + w[1]) : "") + ",toolbar=0,location=no,resizable=yes,menubar=no,scrollbars=") + ((u == true) ? "yes": "no"))
    }
    setTimeout(function() {
        o.focus()
    },
    100);
    WorkflowContext.WindowOpened(f);
    addChildWindowID(f, h, o);
    return o
};
function toggleDisabled(d) {
    try {
        d.disabled = d.disabled ? false: true
    } catch(f) {}
    if (d.childNodes && d.childNodes.length > 0) {
        for (var b = 0; b < d.childNodes.length; b++) {
            toggleDisabled(d.childNodes[b])
        }
    }
}
function weDisableStuff(d) {
    if (isLogicalWindow(d)) {
        d = getTopWinWindowID_NS()
    }
    var b = getOpenDIVPopup_NS(d);
    if (b && b.mModal) {
        return
    }
    if (window.weDisabledObj == null || window.weDisabledObj.style.visibility == "hidden") {
        var h = getCharEditPopups_NS(d);
        for (var f = 0; f < h.length; f++) {
            toggleDisabled(h[f].mDiv)
        }
    }
    if (!window.weDisabledObj) {
        var g = document.createElement("DIV");
        g.style.top = "0px";
        g.style.left = "0px";
        g.style.width = "100%";
        g.style.height = "100%";
        g.style.backgroundColor = "black";
        g.style.opacity = ".20";
        g.style.zIndex = nextZIndex++;
        g.style.visibility = "visible";
        window.weDisabledObj = g;
        document.body.appendChild(g)
    } else {
        window.weDisabledObj.style.visibility = "visible";
        window.weDisabledObj.style.zIndex = nextZIndex++
    }
}
function weDisableStuffActive(b) {
    if (window.weDisabledObj && window.weDisabledObj.style.visibility == "visible") {
        return true
    }
    return false
}
function weEnableStuff(d) {
    if (isLogicalWindow(d)) {
        d = getTopWinWindowID_NS()
    }
    var b = getOpenDIVPopup_NS(d);
    if (b && b.mModal) {
        return
    }
    if (window.weDisabledObj && window.weDisabledObj.style.visibility == "visible") {
        var h = getCharEditPopups_NS(d);
        for (var f = 0; f < h.length; f++) {
            toggleDisabled(h[f].mDiv)
        }
    }
    if (window.weDisabledObj) {
        if (formModalList.mStack.length > 0) {
            var g = formModalList.mLowestZIndex;
            window.weDisabledObj.style.zIndex = g - 1
        } else {
            window.weDisabledObj.style.visibility = "hidden"
        }
    }
}
window.weOpenDialogue = function(g, d, o, B, C, A, b) {
    B.wMode = 0;
    if (window.weDialogueName != null) {
        return
    }
    weDisableStuff(g);
    if (b != 20) {
        var v = new Date().getTime() + "D";
        window.weDialogueName = v;
        var p, k;
        var q = "";
        if (A) {
            p = screen.width / 2;
            k = screen.height / 2;
            p -= (A[0] / 2);
            k -= (A[1] / 2);
            if (p < 0) {
                p = 0
            }
            if (k < 0) {
                k = 0
            }
            p = Math.floor(p);
            k = Math.floor(k);
            q = ",width=" + A[0] + ",height=" + A[1] + ",left=" + p + ",top=" + k
        }
        var h = allocWindowID_NS();
        setWindowMode(h, "D");
        setWindowType(h, o);
        setWindowArgs_NS(h, B);
        setcontinuationFuncs_NS(h, C);
        var u = makeweChildNameUsingParent(window, v);
        setChildWindowIDForName(u, h);
        setOpenerWindowID(h, g, window);
        setChildArrived_NS(h, false);
        var y = window.open(d, v, "toolbar=no,location=no,resizable=yes,scrollbars=no,menubar=no" + q);
        if (y == null) {
            window.weDialogueName = null;
            weEnableStuff(g);
            return y
        } else {
            addChildWindowID(g, h, y)
        }
    } else {
        var v = new Date().getTime() + "P";
        window.weDialogueName = v;
        if (d.indexOf(window.location.pathname) == 0) {
            d += ("&n=" + v)
        }
        var h = allocWindowID_NS();
        setWindowMode(h, "D");
        setWindowType(h, o);
        setWindowArgs_NS(h, B);
        setcontinuationFuncs_NS(h, C);
        var u = makeweChildNameUsingParent(window, v);
        setChildWindowIDForName(u, h);
        setOpenerWindowID(h, g, window);
        setChildArrived_NS(h, false);
        var f;
        if (B.cb == 1) {
            f = new DialogPopup(g, true);
            if (A != null) {
                A[1] += 26;
                A[0] += 2
            }
        } else {
            f = new DialogPopup(g, false)
        }
        if (A != null) {
            f.SetSize(A[0], A[1])
        }
        f.SetContents(v, B.title, d);
        f.ShowCentredPopup(false);
        var y = f.mIFrame.window;
        addChildWindowID(g, h, y)
    }
    WorkflowContext.WindowOpened(g);
    var s = new weWindow(y, B, v, o, C);
    wePuntFocus(g);
    return s
};
window.weOpenModalPopup = function(f, b, h, v, p, u) {
    var o = function(y, w) {
        p.result = w;
        var A = getCurWFC_NS(y);
        if (A) {
            isFromResume = 1;
            A.resume();
            isFromResume = 0
        }
    };
    v.wMode = 0;
    if (window.weDialogueName != null) {
        return
    }
    var q = new Date().getTime() + "P";
    window.weDialogueName = q;
    var g = allocWindowID_NS();
    setWindowMode(g, "D");
    setWindowType(g, h);
    setWindowArgs_NS(g, v);
    setcontinuationFuncs_NS(g, o);
    setOpenerWindowID(g, f, window);
    var k = makeweChildNameUsingParent(window, q);
    setChildWindowIDForName(k, g);
    setChildArrived_NS(g, false);
    var d = new DialogPopup(f, true);
    if (u != null) {
        d.SetSize(u[0], u[1])
    }
    d.SetContents(q, v.title, b);
    d.ShowCentredPopup(false);
    var s = d.mIFrame.window;
    addChildWindowID(f, g, s);
    WorkflowContext.WindowOpened(f);
    wePuntFocus(f);
    return {
        i: 1
    }
};
window.weOpenModelessPopup = function(d, b, g, q, s, p) {
    q.wMode = 0;
    var k = new Date().getTime() + "MD";
    var f = allocWindowID_NS();
    setWindowMode(f, "MD");
    setWindowType(f, g);
    setWindowArgs_NS(f, q);
    setcontinuationFuncs_NS(f, s);
    setOpenerWindowID(f, d, window);
    var h = makeweChildNameUsingParent(window, k);
    setChildWindowIDForName(h, f);
    var o = window.open(b, k, "toolbar=no,location=no,resizable=yes,scrollbars=no,menubar=no" + (p ? (",width=" + p[0] + ",height=" + p[1]) : ""));
    addChildWindowID(d, f, o);
    WorkflowContext.WindowOpened(d);
    return o
};
window.weCloseNonModalChildren = function(d) {
    var b = getChildWindowIDs(d);
    if (b == null) {
        return
    }
    var g = b.length;
    for (var f = 0; f < g; f++) {
        var h = b[f].windowID;
        if (getWindowMode(h).indexOf("MD") != -1) {
            weForceDialogueClose();
            removeChildWindowID(d, h)
        }
    }
};
window.weExtractWindowType = function(h, d) {
    var g = makeweChildName(h, d);
    var b = getChildWindowIDFromName(g);
    var f = getWindowType(b);
    return f
};
window.weExtractArgs = function(h, f) {
    var g = makeweChildName(h, f);
    var d = getChildWindowIDFromName(g);
    var b = getWindowArgs_NS(d);
    setWindowArgs_NS(d, null);
    return b
};
window.weChildGone = function(o, d, p, q, g) {
    var b = getChildWindowIDs(o);
    var s = false;
    for (var h in b) {
        if (b[h].windowID == d) {
            s = true;
            break
        }
    }
    if (!s) {
        return
    }
    if (weAmDialogue(q)) {
        var f = getcontinuationFuncs_NS(d);
        if (weAmModal(q)) {
            window.weDialogueName = null;
            if (f == null) {
                weEnableStuff(o)
            }
        }
        if (f != null) {
            var k = {};
            if (g) {
                weDeepCopy(k, g)
            }
            window.setTimeout(function() {
                if (weAmModal(q)) {
                    weEnableStuff(o)
                }
                if (f) {
                    f(o, k)
                }
            },
            100)
        }
    }
    if (typeof FieldList != "undefined") {
        FieldList.SetAllGlobals(o)
    }
    removeChildWindowID(o, d)
};
window.weChildCome = function(d, q, f) {
    var o = null;
    var v = makeweChildName(d, q);
    var b = getChildWindowIDFromName(v);
    if ((typeof b == "undefined") || (b == null)) {
        b = allocWindowID_NS();
        setWindowArgs_NS(b, null);
        setChildWindowIDForName(v, b);
        setWindowType(b, f);
        setcontinuationFuncs_NS(b, null);
        var g = null;
        var u = v.indexOf("IF_");
        if (u != -1) {
            g = parseInt(v.substring(u + 3))
        }
        if (typeof g == "undefined" || g == null) {
            g = null;
            if (weAmInViewField(q)) {
                var w = parseInt(q.substring(2));
                for (var s in fc.formContexts) {
                    var p = fc.formContexts["" + s].ViewFields;
                    for (var h in p) {
                        if (h == w) {
                            var k = p[h];
                            if (!k.isInlineForm()) {
                                g = k.windowID;
                                break
                            }
                        }
                    }
                    if (g != null) {
                        break
                    }
                }
            }
        }
        if (g == null) {
            g = getTopWinWindowID_NS()
        }
        setOpenerWindowID(b, g, window);
        addChildWindowID(g, b, d)
    }
    setChildArrived_NS(b, true)
};
function weOnUnload(f) {
    if ((typeof window.weunloadcalled != "undefined") && (window.weunloadcalled == true)) {
        return
    }
    window.weunloadcalled = true;
    if (typeof f == "undefined") {
        f = getTopWinWindowID_NS()
    }
    var w = false;
    var d = getChildWindowIDs(f);
    var C = (d != null) ? d.length: 0;
    for (var p = 0; p < C; p++) {
        if (getWindowArgs_NS(d[p]) != null) {
            w = true;
            break
        }
    }
    if (w) {
        LogAndAlert(getLocalizedMessage("Warning: If AR System windows are still loading, they will load incorrectly.\nIf you have AR System windows still loading, do not press 'OK' until they are complete."))
    }
    if (window.weDialogueName != null) {
        var y = getChildWindowIDFromName(window.weDialogueName);
        var k = null;
        var g = false;
        for (var p in d) {
            if (d[p].windowID == y) {
                g = true;
                k = d[p].windowObj;
                break
            }
        }
        if (k != null) {
            if (typeof k.window.weForceDialogueClose != "undefined") {
                k.window.weForceDialogueClose()
            }
            removeChildWindowID(f, y);
            window.weDialogueName = null
        }
    }
    weCloseNonModalChildren(f);
    hookChildrenToOpener(f);
    var o = getLogicalChildWindowIDs(f);
    for (var p in o) {
        LogicalWindowOnUnload(o[p])
    }
    var A = getViewFields_NS(f);
    for (var q in A) {
        if (A[q].mObj.firstChild && A[q].mObj.firstChild.nodeName == "IFRAME") {
            A[q].mObj.removeChild(A[q].mObj.firstChild)
        }
    }
    try {
        if (typeof window.weOpener != "undefined") {
            var u = makeweChildName(window, window.name);
            var b = window.weOpener.window.getChildWindowIDFromName(u);
            if (typeof b != "undefined") {
                var h = window.weOpener.window.getOpenerWindowID(b);
                if (h != null && "weChildGone" in h.windowObj.window) {
                    h.windowObj.window.weChildGone(h.windowID, b, window, window.name, "weDialogueReturnValue" in window ? window.weDialogueReturnValue: null)
                }
            }
        }
    } catch(v) {}
    document.body.disabled = true;
    var s = document.createElement("DIV");
    s.style.top = 0;
    s.style.left = 0;
    s.style.width = 2400;
    s.style.height = 1900;
    s.style.backgroundColor = "white";
    s.style.zIndex = 110000;
    document.body.appendChild(s);
    var B = document.getElementById("PostAppletElement");
    if (B) {
        B.parentNode.removeChild(B)
    }
    if (weAmPopup(window.name)) {
        if ("external" in window.weOpener) {
            for (var p in getFields_NS(f)) {
                try {
                    window.weOpener.external.PopupFormUnLoaded()
                } catch(s) {}
                return
            }
            try {
                window.weOpener.external.PopupUnLoaded()
            } catch(s) {}
        }
    } else {
        if ("external" in window) {
            try {
                window.external.FormUnloaded()
            } catch(s) {}
        }
    }
}
function LogicalWindowOnUnload(f) {
    if (!isLogicalWindow(f)) {
        return
    }
    var k = getLogicalChildWindowIDs(f);
    for (var o in k) {
        LogicalWindowOnUnload(k[o])
    }
    var b = getChildWindowIDs(f);
    var s = (b != null) ? b.length: 0;
    var p = false;
    for (var o = 0; o < s; o++) {
        if (getWindowArgs_NS(b[o]) != null) {
            p = true;
            break
        }
    }
    if (p) {
        LogAndAlert(getLocalizedMessage("Warning: If AR System windows are still loading, they will load incorrectly.\nIf you have AR System windows still loading, do not press 'OK' until they are complete."))
    }
    if (window.weDialogueName != null) {
        var q = getChildWindowIDFromName(window.weDialogueName);
        var h = null;
        var g = false;
        for (var o in b) {
            if (b[o].windowID == q) {
                g = true;
                h = b[o].windowObj;
                break
            }
        }
        if (h != null) {
            if (typeof h.window.weForceDialogueClose != "undefined") {
                h.window.weForceDialogueClose()
            }
            removeChildWindowID(f, q);
            window.weDialogueName = null
        }
    }
    var d = getFormContext(f).ALInterval;
    if (d.length > 0) {
        while (d.length > 0) {
            clearInterval(d.pop())
        }
        promptBar.setToClear()
    }
    weCloseNonModalChildren(f);
    hookChildrenToOpener(f)
}
function weGetDialogueParentID() {
    if (typeof window.weOpener != "undefined" && window.weOpener != null) {
        var g = makeweChildName(window, window.name);
        var d = window.weOpener.window.getChildWindowIDFromName(g);
        if (typeof d != "undefined") {
            var f = window.weOpener.window.getOpenerWindowID(d);
            if (f != null) {
                return f.windowID
            }
        } else {
            if (weAmInViewField(g)) {
                var b = g.indexOf("IF_");
                if (b != -1) {
                    return parseInt(g.substring(b + 3))
                }
            }
        }
    }
    return 0
}
function weCloseDialogue(f, b) {
    window.weDialogueReturnValue = b;
    var g = window.weOpener.window.getChildWindowIDFromName(window.name);
    var h = window.weOpener.window.getOpenerWindowID(g);
    var d = window.weOpener.window.getOpenDIVPopup_NS(h.windowID);
    if (d != null) {
        weOnUnload(f);
        d.HidePopup(false)
    } else {
        window.close()
    }
}
var REGEXPDIALOGUE1 = /^[0-9]+(D{1}|(M{1}D{1})|P{1})$/g;
var REGEXPDIALOGUE2 = /^[0-9]+(M{1}|(M{1}D{1}))$/g;
var REGEXPDIALOGUE3 = /^[0-9]+(P{1})$/g;
function weAmDialogue(b) {
    return (b.match(REGEXPDIALOGUE1) != null)
}
function weAmModal(b) {
    return (b.match(REGEXPDIALOGUE2) == null)
}
function weAmPopup(b) {
    return (b.match(REGEXPDIALOGUE3) != null)
}
function weGetOpenDialogueName() {
    return window.weDialogueName
}
function weAmInViewField(d) {
    var b = /VF[0-9]+/;
    if (d == null) {
        return false
    }
    return (d.match(b) != null)
}
function makeweChildName(d, b) {
    return b
}
function makeweChildNameUsingParent(d, b) {
    return b
}
function weGetWindowType(b) {
    if (arguments.length == 0) {
        if (window && window.arWindowType) {
            return window.arWindowType
        } else {
            return null
        }
    }
    return getWindowType(b)
}
window.weForceDialogueClose = function() {
    window.onbeforeunload = window.onunload = null;
    licenseSessionCloseWindow();
    if (window.weDialogueName != null) {
        var h = getChildWindowIDFromName(window.weDialogueName);
        for (var q in wm.weChildrenWindowIDs) {
            var b = wm.weChildrenWindowIDs["" + q];
            if (typeof b != "undefined") {
                var k = null,
                g = false;
                for (var o in b) {
                    if (b[o].windowID == h) {
                        g = true;
                        k = b[o].windowObj;
                        break
                    }
                }
                if (k != null) {
                    k.window.weForceDialogueClose();
                    break
                }
            }
        }
    }
    var d = window.weOpener.window.getChildWindowIDFromName(window.name);
    var p = window.weOpener.window.getOpenerWindowID(d);
    var f = window.weOpener.window.getOpenDIVPopup_NS(p.windowID);
    if (f != null) {
        f.HidePopup(false)
    }
    setInterval("window.close()", 10)
};
function wePunt(b) {
    if (window.weDialogueName) {
        var f = getChildWindowIDFromName(window.weDialogueName);
        var k = getChildWindowIDs(b);
        var d = false;
        var h = null;
        for (var g in k) {
            if (k[g].windowID == f) {
                d = true;
                h = k[g].windowObj;
                break
            }
        }
        if (h != null && window != h) {
            if (!h.closed) {
                if (!h.closed && typeof h.window != "undefined" && h.wePunt) {
                    h.window.wePunt(h.window.getTopWinWindowID_NS())
                }
            } else {
                if (!getChildArrived_NS(f)) {
                    weChildGone(b, f, window, window.weDialogueName, null)
                }
            }
        } else {}
    } else {
        window.focus()
    }
}
function wePuntFocus(b) {
    if (window.weDialogueName) {
        setTimeout(function() {
            wePunt(b)
        },
        100);
        if ("Menu_Close" in window.self) {
            Menu_Close()
        }
        return true
    }
    return false
}
function weCloseAllWindows(f, q, o, d) {
    var b = getChildWindowIDs(f);
    if (b != null) {
        for (winId in b) {
            var k = b[winId].windowObj;
            if (k == q) {
                continue
            }
            if (k && !k.closed && "weCloseAllWindows" in k) {
                k.window.weCloseAllWindows(getTopWinWindowID_NS(), k, false, null)
            } else {
                if (k && !k.closed) {
                    k.window.weCloseWindow(f, k, false)
                }
            }
        }
    }
    var g = getLogicalChildWindowIDs(f);
    for (var h in g) {
        weCloseAllWindows(g[h], q, false, d)
    }
    if (isLogicalWindow(f)) {
        return
    }
    if (q.weAmDialogue(q.name)) {
        q.weCloseDialogue(f, null)
    } else {
        if (o == true && d != null) {
            try {
                q.document.location = d
            } catch(p) {}
        } else {
            weCloseWindow(f, q, o)
        }
    }
}
function weRecurAllWindowsIterator(f) {
    windowID = getTopWinWindowID_NS();
    var g = getChildWindowIDs(windowID);
    for (var d in g) {
        var b = g[d].windowObj;
        if (b && !b.closed && "weRecurAllWindowsIterator" in b) {
            f.push(b);
            b.weRecurAllWindowsIterator(f)
        }
    }
}
function weGetAllWindows(b) {
    var d = new Array();
    var g = window;
    if ("weOpener" in g && g.weOpener == null && "weRecurAllWindowsIterator" in g) {
        d.push(g)
    } else {
        try {
            while (g.weOpener && !g.weOpener.closed && "weRecurAllWindowsIterator" in g.weOpener) {
                g = g.weOpener;
                if ("weOpener" in g && g.weOpener == null && "weRecurAllWindowsIterator" in g) {
                    d.push(g)
                }
            }
        } catch(f) {}
    }
    try {
        g.weRecurAllWindowsIterator(d)
    } catch(f) {}
    return d
}
function weGetChildWindows(b) {
    var f = new Array();
    var d = getChildWindowIDs(b);
    for (i in d) {
        f.push(d[i].windowObj)
    }
    return f
}
function weGetWindowByName(d, f) {
    var h = weGetAllWindows(d);
    try {
        for (var g = 0; g < h.length; g++) {
            var b = h[g];
            if (b && !b.closed && "weRecurAllWindowsIterator" in b) {
                if (b.name == f) {
                    return b
                }
            }
        }
    } catch(k) {}
    return null
}
function weCloseWindowInterval(d, f, b) {
    if (!b) {
        f.close()
    } else {
        setTimeout(function() {
            if (!f.closed && getStateMgr_NS(d).mWindowIsClosed) {
                f.close()
            }
        },
        0)
    }
}
function weCloseWindow(d, k, h) {
    if (isLogicalWindow(d)) {
        var f = getLogicalWindow(d);
        if (f != null) {
            f.setClearInlineFormFlag(true)
        }
        return
    }
    var q = (showWaitCursor == 1 || showWaitCursor == 4);
    if (h) {
        if (k.history.length != undefined) {
            var g = k.history.length;
            var o = g - 1;
            if (q) {
                o--
            }
            if (k.hlength < g) {
                o -= (g - k.hlength)
            }
            if (o <= 0) {
                weCloseWindowInterval(d, k, h)
            } else {
                var b = 3;
                var p = (q) ? b: 1;
                if (k.hlength < g) {
                    p += (g - k.hlength)
                }
                if (k.history.length >= p) {
                    k.history.go( - p)
                } else {
                    k.history.go( - 1)
                }
            }
        } else {
            weCloseWindowInterval(d, k, h)
        }
    } else {
        weCloseWindowInterval(d, k, h)
    }
}
function weGetOpener(d) {
    if (arguments.length == 0) {
        d = getTopWinWindowID_NS()
    }
    var b = null;
    if (d != null) {
        var f = getOpenerWindowID(d);
        if (f != null) {
            b = f.windowObj
        }
        if (typeof b == "undefined") {
            b = null
        }
    }
    if ((b == null) && (typeof window.weOpener != "undefined")) {
        b = window.weOpener
    }
    return b
}
function weDisplayWFNotes(b, f) {
    if (f.getCurWFC_NS(b)) {
        var d = f.getCurWFC_NS(b).notes;
        if (d.length > 0) {
            f.getCurWFC_NS(b).notes = [];
            return WC_DisplayMessage(b, d)
        }
    }
}
function weDisplayWFException(d, b) {
    if ((b instanceof WorkflowException) && b.mArg && b.mArg.length > 0) {
        return WC_DisplayMessage(d, b.getLStatus())
    } else {
        throw b
    }
}
function createARRootWindowName() {
    return "ARRoot" + new Date().getTime()
}
var WDECurrentDrag = null;
function WDEDragContext(b, d) {
    this.mStartElement = d;
    this.mOrigX = this.mOrigY = 0;
    this.mDX = -b.ox;
    this.mDY = -b.oy;
    this.mX = this.mY = this.mMouseX = this.mMouseY = 0;
    this.mWidth = this.mStartElement.offsetWidth;
    this.mHeight = this.mStartElement.offsetHeight;
    this.mParentElement = this.mStartElement.offsetParent;
    while (!this.mParentElement.getAttribute("draghandler") && this.mParentElement) {
        this.mParentElement = this.mParentElement.offsetParent
    }
    this.mMaxX = this.mParentElement.offsetWidth;
    this.mMaxY = this.mParentElement.offsetHeight;
    this.mMinX = this.mMinY = 0;
    this.mNewElement = null;
    this.mHandler = window.self[this.mParentElement.getAttribute("draghandler")];
    this.mDragState = 0;
    WDECurrentDrag = this;
    this.mParentElement.onmousemove = FormEvent.Trampoline(function(f) {
        return ! WDECurrentDrag.MouseMove(f)
    })
}
WDEDragContext.prototype.MouseMove = function(g) {
    var o = g.element;
    var b = g.ox,
    p = g.oy;
    var h = ComputeElementPosition(o, this.mParentElement, b, p);
    b = h.x;
    p = h.y;
    var k = -1;
    this.mMouseX = b;
    this.mMouseY = p;
    if (this.mDragState == 0) {
        this.mOrigX = b;
        this.mOrigY = p;
        this.mDragState = 1
    } else {
        if (this.mDragState == 1) {
            var d = Math.abs(p - this.mOrigY);
            var f = Math.abs(b - this.mOrigX);
            if (Math.sqrt(d * d + f * f) > 4) {
                if (this.mStartElement.getAttribute("dragoriginal")) {
                    this.mNewElement = this.mStartElement
                } else {
                    this.mNewElement = this.mStartElement.cloneNode(true);
                    this.mNewElement.setAttribute("draggable", "");
                    this.mParentElement.appendChild(this.mNewElement)
                }
                this.mNewElement.className = this.mNewElement.className + " dragging";
                this.mDragState = 2;
                b += f;
                p += d;
                k = 0
            } else {
                return false
            }
        } else {
            if (this.mDragState == 2) {
                p += this.mDY;
                p = (p < this.mMinY ? this.mMinY: p);
                if (p + this.mHeight > this.mMaxY) {
                    p = this.mMaxY - this.mHeight
                }
                b += this.mDX;
                b = (b < this.mMinX ? this.mMinX: b);
                if (b + this.mWidth > this.mMaxX) {
                    b = this.mMaxX - this.mWidth
                }
                this.mNewElement.style.top = p;
                this.mNewElement.style.left = b;
                k = 1
            }
        }
    }
    if (k != -1) {
        this.mX = b;
        this.mY = p;
        this.CallHandler(k)
    }
    return true
};
WDEDragContext.prototype.SetDragBounds = function(d, b, g, f) {
    if (d != null) {
        this.mMinX = d
    }
    if (b != null) {
        this.mMinY = b
    }
    if (g != null) {
        this.mMaxX = g
    }
    if (f != null) {
        this.mMaxY = f
    }
};
WDEDragContext.prototype.CallHandler = function(b) {
    var d = {};
    d.state = b;
    d.x = this.mX;
    d.y = this.mY;
    d.mx = this.mMouseX;
    d.my = this.mMouseY;
    d.srcElement = this.mStartElement;
    d.newElement = this.mNewElement;
    d.dragContext = this;
    d.original = (this.mStartElement == this.mNewElement);
    this.mHandler(d)
};
WDEDragContext.prototype.Stop = function(b) {
    this.mParentElement.onmousemove = null;
    if (this.mDragState >= 2) {
        if (this.mStartElement != this.mNewElement) {
            this.mParentElement.removeChild(this.mNewElement)
        } else {
            this.mStartElement.className = this.mStartElement.className.replace(/dragging/, "")
        }
        if (b) {
            this.mX = this.mOrigX + this.mDX;
            this.mY = this.mOrigY + this.mDY
        }
        this.CallHandler(b ? 3 : 2)
    }
    WDECurrentDrag = null
};
function WDEDragContext_Stop() {
    if (WDECurrentDrag != null) {
        WDECurrentDrag.Stop(true)
    }
}
WDEDragContext.prototype.HandleMouseUp = function(b) {
    var d = b.element;
    while (d && d != this.mParentElement) {
        d = d.offsetParent
    }
    this.Stop(d != this.mParentElement);
    return true
};
function WDEHandleEvent(d, b) {
    if (d == 0) {
        var f = b.element;
        while (f && !f.getAttribute("draggable")) {
            f = f.offsetParent
        }
        if (!f || !f.getAttribute("draggable")) {
            return false
        }
        if ((b.button != 0) || WDECurrentDrag) {
            return true
        }
        new WDEDragContext(b, f);
        return true
    } else {
        if (d == 1 && WDECurrentDrag != null) {
            return WDECurrentDrag.HandleMouseUp(b)
        } else {
            if (d == 3 && b.key == 27 && WDECurrentDrag != null) {
                WDEDragContext_Stop();
                return true
            }
        }
    }
    return false
}
function WorkflowContext(b, f) {
    this.windowID = b;
    this.execStks = [];
    this.guideCtxt = [];
    this.notes = [];
    this.mCallbacks = [];
    this.mStatusTimeout = null;
    this.dirtyElements = {};
    getWindowMgr_NS().pushCurrentWindowID(b);
    if (getWFThreadsList_NS(this.windowID).length == 0) {
        for (var d in getAsyncFields_NS(this.windowID)) {
            getAsyncFields_NS(this.windowID)[d].SetAsync(1)
        }
    }
    getWFThreadsList_NS(this.windowID).push(this);
    setCurWFC_NS(this.windowID, this);
    this.AddCallback(this,
    function() {
        AsyncField_DecrAsyncRef(this.windowID)
    });
    if (keyRefCnt <= 0) {
        keyRefCnt = 0;
        ARKWSetShifCtrlAltToRealtime()
    }
    keyRefCnt++;
    this.execute(f)
}
WorkflowContext.prototype.mOpenedWindow = false;
WorkflowContext.prototype.setStatus = function(d) {
    var b = window.status;
    window.status = d;
    if (this.mStatusTimeout != null) {
        clearTimeout(this.mStatusTimeout)
    }
    this.mStatusTimeout = setTimeout(function() {
        window.status = b;
        this.mStatusTimeout = null
    },
    5000)
};
WorkflowContext.prototype.pushEntryIntoCurrentStack = function(g) {
    if (g) {
        var b = this.execStks;
        var f;
        if (b.length > 0) {
            f = b[b.length - 1]
        } else {
            f = b
        }
        if (g instanceof Array) {
            for (var d in g) {
                f.push(g[d])
            }
        } else {
            f.push(g)
        }
    }
};
WorkflowContext.prototype.pushEntryForBulk = function(g) {
    if (g) {
        var b = this.execStks;
        var f;
        if (b.length > 0) {
            f = b[b.length - 1]
        } else {
            f = b
        }
        if (g instanceof Array) {
            for (var d in g) {
                if (g[d].n) {
                    f.push(g[d].n)
                }
                if (g[d].c) {
                    f.push(g[d].c)
                }
            }
        } else {
            if (g.n) {
                f.push(g.n)
            }
            if (g.c) {
                f.push(g.c)
            }
        }
    }
};
WorkflowContext.prototype.resume = function(d) {
    if (d) {
        var b = this.execStks;
        if (d instanceof Array) {
            b.push(d)
        } else {
            b.push([d])
        }
    }
    this.executeAll()
};
var INTERRUPTED_SE = {
    i: 1
};
var EXECUTED_STACK = [];
WorkflowContext.prototype.executeAll = WorkflowContext.prototype.execute = function(s) {
    setIsInInterruptMode_NS(this.windowID, 0);
    var w = this.execStks;
    var u;
    var p;
    if (s) {
        if (s instanceof Array) {
            w.push(s)
        } else {
            w.push([s])
        }
        u = 1
    } else {
        u = w.length
    }
    try {
        while (u > 0) {
            p = w[w.length - 1];
            while (p.length > 0) {
                var s = p.pop();
                if (s.eonly) {
                    continue
                }
                var b;
                try {
                    b = (s.a) ? s.f.apply(s.t ? s.t: null, s.a) : ((s.t) ? s.f.apply(s.t, []) : s.f())
                } catch(f) {
                    while (true) {
                        if (s.e) {
                            var h = [f];
                            if (s.ea) {
                                h = h.concat(s.ea)
                            }
                            try {
                                b = (s.t) ? s.e.apply(s.t, h) : s.e.apply(null, h);
                                if ((f instanceof WorkflowException) && f.hasMessages()) {
                                    var k = f.getStatus();
                                    if (k[0].n == 9201) {
                                        while (p.length > 0) {
                                            p.pop()
                                        }
                                        s = null;
                                        while (u > 0) {
                                            w.pop();
                                            u--
                                        }
                                    }
                                }
                                break
                            } catch(d) {
                                f = d
                            }
                        }
                        do {
                            if (p.length > 0) {
                                s = p.pop()
                            } else {
                                s = null;
                                w.pop();
                                u--;
                                if (u > 0) {
                                    p = w[w.length - 1]
                                } else {
                                    if (w.length > 0) {
                                        throw f
                                    } else {
                                        if (typeof f != "object") {
                                            LogAndAlert("Caught exception " + (f.fileName + ":" + f.lineNumber + " - " + f.name + ":\n\n" + f.message + "... AT:\n\n" + f.stack));
                                            return false
                                        }
                                        if (f instanceof WorkflowException) {
                                            if (f != "") {
                                                if (this.notes.length > 0) {
                                                    var b = WC_DisplayMessage(this.windowID, this.notes);
                                                    this.notes = [];
                                                    if (b && b.i && b.i == 1) {
                                                        w.push([{
                                                            f: WC_DisplayMessage,
                                                            a: [this.windowID, f.getLStatus()]
                                                        }]);
                                                        w.push([{
                                                            f: function() {}
                                                        }]);
                                                        return INTERRUPTED_SE
                                                    }
                                                    b = WC_DisplayMessage(this.windowID, f.getLStatus());
                                                    if (b && b.i && b.i == 1) {
                                                        w.push([{
                                                            f: function() {}
                                                        }]);
                                                        return INTERRUPTED_SE
                                                    }
                                                } else {
                                                    var b = WC_DisplayMessage(this.windowID, f.getLStatus());
                                                    if (b && b.i && b.i == 1) {
                                                        w.push([{
                                                            f: function() {}
                                                        }]);
                                                        return INTERRUPTED_SE
                                                    }
                                                }
                                            }
                                            return false
                                        } else {
                                            LogAndAlert("Caught exception " + (f.fileName + ":" + f.lineNumber + " - " + f.name + ":\n\n" + f.message + "... AT:\n\n" + f.stack));
                                            return false
                                        }
                                    }
                                }
                            }
                        } while ( s == null )
                    }
                }
                if (b) {
                    if (b.i) {
                        if (b.n) {
                            p.push(b.n)
                        } else {
                            if (p.length == 0 && w.length > 0 && w[w.length - 1].length == 0) {
                                w.pop();
                                u--
                            }
                        }
                        setIsInInterruptMode_NS(this.windowID, 1);
                        return INTERRUPTED_SE
                    } else {
                        if (b.isFromFunctionSplit) {
                            if (s.e) {
                                var v = (s.ea) ? {
                                    eonly: 1,
                                    e: s.e,
                                    ea: s.ea,
                                    t: s.t
                                }: {
                                    eonly: 1,
                                    e: s.e,
                                    t: s.t
                                };
                                p.push(v)
                            }
                        }
                        if (b.n) {
                            if (b.n instanceof Array) {
                                for (var g in b.n) {
                                    p.push(b.n[g])
                                }
                            } else {
                                p.push(b.n)
                            }
                        }
                        if (b.c) {
                            if (!b.isFromFunctionSplit) {
                                if (s.e) {
                                    var v = (s.ea) ? {
                                        eonly: 1,
                                        e: s.e,
                                        ea: s.ea,
                                        t: s.t
                                    }: {
                                        eonly: 1,
                                        e: s.e,
                                        t: s.t
                                    };
                                    p.push(v)
                                }
                            }
                            p.push(b.c)
                        }
                    }
                }
            }
            w.pop();
            u--
        }
        return false
    } finally {
        if (w.length == 0) {
            if (this.notes.length > 0) {
                var b = WC_DisplayMessage(this.windowID, this.notes);
                this.notes = [];
                if (b && b.i && b.i == 1) {
                    w.push([{
                        f: function() {}
                    }]);
                    return INTERRUPTED_SE
                }
            }
            if (getWFThreadsList_NS(this.windowID).length == 1) {
                this.RunCallbacks()
            }
            FocusMgr.WorkflowComplete(this.windowID);
            if (getWFThreadsList_NS(this.windowID).length > 0 && getWFThreadsList_NS(this.windowID)[getWFThreadsList_NS(this.windowID).length - 1].execStks.length == 0) {
                var o = getWFThreadsList_NS(this.windowID).pop();
                getWindowMgr_NS().popCurrentWindowID(this.windowID);
                if (getWFThreadsList_NS(this.windowID).length > 0) {
                    setCurWFC_NS(this.windowID, getWFThreadsList_NS(this.windowID)[getWFThreadsList_NS(this.windowID).length - 1])
                } else {
                    setIsInInterruptMode_NS(this.windowID, 0);
                    setCurWFC_NS(this.windowID, null)
                }
            } else {
                setIsInInterruptMode_NS(this.windowID, 0);
                setCurWFC_NS(this.windowID, null)
            }
            keyRefCnt--;
            if (keyRefCnt <= 0) {
                keyRefCnt = 0;
                ARKWSetShifCtrlAltToRealtime()
            }
            if (isLogicalWindow(this.windowID)) {
                var q = getLogicalWindow(this.windowID);
                if ((q != null) && (q.getClearInlineFormFlag() == true)) {
                    q.Clear()
                }
            }
        }
    }
};
var FIDMATCH = /^((.*)(:)\s*([0-9]+)\s*)$|([0-9]+)$/;
function WorkflowContext_StatusFIDToLabel(b, h) {
    var f = h.match(FIDMATCH);
    if (f != null && ((f[4] != "" && f[4] != null) || (f[5] != "" && f[5] != null))) {
        var g = (f[4] == "" || f[4] == null) ? parseInt(f[5]) : parseInt(f[4]);
        var d = F(b, g).GLabel();
        if (d == null || d == " " || d == "") {
            d = F(b, g).GName()
        }
        if (d != null && d != "") {
            h = (f[2] == null ? "": f[2]) + (f[3] == null ? "": f[3]) + " " + d
        }
    }
    return h
}
function WorkflowContext_StatusToString(windowID, arr) {
    var AR_WARN_NO_READ_ACCESS = 60;
    var ntypes = {
        1 : "ARWARN",
        0 : "ARNOTE",
        2 : "ARERR",
        3 : "ARERR"
    };
    var out = [];
    for (var i = 0; i < arr.length; ++i) {
        with(arr[i]) {
            if (n == 0) {
                continue
            }
            if (m != null && m != "" || a == null || ntypes[t] == "ARERR" || ntypes[t] == "ARWARN") {
                if (m == null || m == "") {
                    m = getLocalizedMessage(n, null)
                }
                if ("cId" in arr[i] && (t != 0) && (n < 9999)) {
                    out.push(WorkflowContext_StatusFIDToLabel(windowID, m))
                } else {
                    if (m != n) {
                        out.push(ExpandString(windowID, m, 1 | 2 | 4))
                    }
                }
                if (a) {
                    if (m != n) {
                        out.push(" :\n")
                    }
                    if ("cId" in arr[i] && t != 0 && n < 9999 && n != AR_WARN_NO_READ_ACCESS) {
                        out.push(WorkflowContext_StatusFIDToLabel(windowID, a))
                    } else {
                        out.push(a)
                    }
                }
            } else {
                out.push(a)
            }
            out.push(" (");
            out.push(ntypes[t]);
            out.push(" ");
            out.push(n);
            out.push(")");
            out.push("\n")
        }
    }
    return out.join("")
}
function WC_DisplayMessage(d, h) {
    var b = [];
    var o = 0;
    for (var g = 0; g < h.length; ++g) {
        var f = promptBar.redirectAtRuntime(h[g].msgloc);
        if (f == 0) {
            var k = promptBar.buildMsgforPrompt(d, h[g].mstat);
            promptBar.showMessage(promptBar.ARTypetoPromptType(h[g].mstat.t), k);
            o++
        } else {
            b.push(h[g].mstat)
        }
    }
    if (o > 0) {
        promptBar.showAllMessages()
    }
    if (b.length > 0) {
        return MessagePopup(d, b)
    } else {
        return null
    }
}
WorkflowContext.prototype.status = function(s, b) {
    var d = false;
    if (arguments.length == 2) {
        d = true
    } else {
        b = null
    }
    var q = this.notes;
    if (s instanceof Array) {
        var p = [];
        for (var f in s) {
            var k = s[f];
            if (k.t == 2 || k.t == 3) {
                var h = promptBar.msgDestination(k.t, d, b);
                p.push({
                    mstat: k,
                    msgloc: h
                })
            } else {
                if (k.t == 0 && k.n == 8914) {
                    LogWrite(WorkflowContext_StatusToString(this.windowID, [k]), true)
                } else {
                    var h = promptBar.msgDestination(k.t, d, b);
                    var o = {
                        mstat: k,
                        msgloc: h
                    };
                    q.push(o)
                }
            }
        }
        if (p.length) {
            if (this.guideCtxt.length > 0) {
                throw new WorkflowException(this.windowID, 5, p)
            } else {
                throw new WorkflowException(this.windowID, 0, p)
            }
        }
    } else {
        var g = {
            n: s,
            t: 2,
            m: null,
            a: null
        };
        var h = promptBar.msgDestination(2, d, b);
        throw new WorkflowException(this.windowID, 0, [{
            mstat: g,
            msgloc: h
        }])
    }
};
WorkflowContext.WindowOpened = function(b) {
    if (getCurWFC_NS(b)) {
        getCurWFC_NS(b).mOpenedWindow = true
    }
};
WorkflowContext.prototype.enterGuide = function(b) {
    this.guideCtxt.push(b)
};
WorkflowContext.prototype.getGuideState = function() {
    var b = this.guideCtxt.length;
    if (b > 0) {
        return this.guideCtxt[b - 1]
    } else {
        return null
    }
};
WorkflowContext.prototype.exitGuide = function() {
    this.guideCtxt.pop()
};
WorkflowContext.prototype.AddCallback = function(d, f, b) {
    this.mCallbacks.push({
        t: d,
        func: f,
        args: b
    })
};
WorkflowContext.prototype.RunCallbacks = function() {
    while (this.mCallbacks.length > 0) {
        var b = this.mCallbacks.pop();
        b.func.apply(b.t, b.args ? b.args: [])
    }
};
WorkflowContext.prototype.addDirtyElement = function(d, b) {
    this.dirtyElements[d] = b
};
WorkflowContext.prototype.signalDOM = function() {
    for (var b in this.dirtyElements) {
        if ("onchange" in this.dirtyElements[b]) {
            FormEvent.FireChangeEvent(this.dirtyElements[b])
        }
    }
    this.dirtyElements = {}
};
var FocusMgr;
function FocusMgr_Init() {
    FocusMgr = new
    function() {
        this.mCurFocusID = 0;
        this.mCurFocusWindowID = 0;
        this.mCurFocusElement = null;
        this.mOpenedWindow = false;
        this.mFocusStk = [];
        this.HandleFocusEvt = function(d, g) {
            if (this.mFocusStk.length > 0) {
                return
            }
            var k = g.element.getAttribute("artabid");
            if (!k && g.element.parentNode.parentNode && g.element.parentNode.parentNode.getAttribute("artabid")) {
                k = g.element.parentNode.parentNode.getAttribute("artabid")
            }
            if (!k && g.element.parentNode && g.element.parentNode.getAttribute("artabid")) {
                k = g.element.parentNode.getAttribute("artabid")
            }
            var h = (k) ? getFields_NS(d)[k] : Field_FromElement(g.element);
            if (h) {
                var b = h.GetFocusElementForEvent(g);
                if (b != null) {
                    this.mUIFocusElement = g.element;
                    return {
                        c: {
                            t: this,
                            f: this.changeFocusTo,
                            a: [h.windowID, h.mID, g, b]
                        }
                    }
                } else {
                    this.mForceFocusToCurrent = true
                }
            }
        };
        this.changeFocusTo = function(f, h, d, b) {
            var k = true;
            if (f == this.mCurFocusWindowID && h == this.mCurFocusID) {
                k = false
            }
            if (k) {
                var g = this.mFocusStk.length;
                if (g == 0) {
                    this.mFocusStk.push({
                        ty: 2
                    });
                    this.mWFC = getCurWFC_NS(f)
                }
                this.mFocusStk.push({
                    id: h,
                    ed: d,
                    fe: b,
                    ty: 1,
                    wID: f
                });
                if (this.mCurFocusID != 0 && getFormContext(this.mCurFocusWindowID)) {
                    this.mFocusStk.push({
                        id: this.mCurFocusID,
                        ed: new FormEvent(this.mCurFocusWindowID, this.mCurFocusID),
                        ty: 0,
                        wID: this.mCurFocusWindowID
                    })
                }
                return {
                    n: {
                        t: this,
                        f: this.transitionFocus,
                        a: [f, g]
                    }
                }
            } else {
                if (d) {
                    if ((!this.mUIFocusElement) || this.mCurFocusElement != d.element) {
                        this.mCurFocusElement = b;
                        this.mForceFocusToCurrent = (!this.mUIFocusElement) || (b != d.element) || ((h in getFields_NS(f)) && getFields_NS(f)[h].mPaneltemplate != null)
                    }
                }
            }
        };
        this.transitionFocus = function(g, b) {
            while (this.mFocusStk.length > b) {
                var d = this.mFocusStk.pop();
                if (d.ty == 2) {
                    return
                } else {
                    var k = getFields_NS(d.wID)[d.id];
                    var p;
                    var h = this.mCurFocusID;
                    var q = this.mCurFocusWindowID;
                    var s = this.mCurFocusElement;
                    switch (d.ty) {
                    case 0:
                        p = k.DOMBlur;
                        break;
                    case 1:
                        this.mCurFocusID = d.id;
                        this.mCurFocusWindowID = g;
                        if (this.mCurFocusID <= 0) {
                            this.mCurFocusElement = null;
                            continue
                        }
                        this.mCurFocusElement = d.fe;
                        p = k.DOMFocus;
                        break;
                    default:
                    }
                    promptBar.setToClear();
                    var o = getCurWFC_NS(g).execute({
                        t: k,
                        f: p,
                        a: [d.ed],
                        e: this.ftExceptionHandler,
                        ea: [q, h, s]
                    });
                    if (o) {
                        return {
                            i: 1,
                            n: {
                                t: this,
                                f: this.transitionFocus,
                                a: [g, b]
                            }
                        }
                    }
                }
            }
        };
        this.TryFocus = function(b, d) {
            try {
                if (("focus" in d) && !d.disabled && d.parentNode && ((this.mCurFocusID in getFields_NS(b)) && getFields_NS(b)[this.mCurFocusID].GetNestedFocusability())) {
                    d.focus();
                    return true
                }
            } catch(f) {}
            return false
        };
        this.reallySetFocus = function(b) {
            var d = this.mCurFocusElement;
            if (!this.mOpenedWindow && (this.mFocusStk.length == 0)) {
                this.mForceFocusToCurrent = false;
                if (this.TryFocus(b, d)) {
                    return
                }
                if (this.mCurFocusID) {
                    this.mCurFocusElement = getFields_NS(this.mCurFocusWindowID)[this.mCurFocusID].GetFocusElement();
                    if (this.TryFocus(this.mCurFocusWindowID, this.mCurFocusElement)) {
                        return
                    }
                }
                this.TryFocus(b, this.mCurFocusElement = document.body)
            }
        };
        this.getFocusedID = function() {
            return this.mCurFocusID
        };
        this.resetFocus = function(b) {
            if (!b) {
                return
            }
            this.resettheFocus()
        };
        this.resettheFocus = function() {
            this.mresetEle = this.mCurFocusElement;
            this.mresetFid = this.mCurFocusID;
            this.mresetWid = this.mCurFocusWindowID;
            setTimeout(function() {
                if (typeof FocusMgr.mresetEle != "undefined") {
                    FocusMgr.TryFocus(FocusMgr.mresetWid, FocusMgr.mresetEle);
                    if (typeof this.mresetFid != "undefined") {
                        getFields_NS(FocusMgr.mresetWid)[FocusMgr.mresetFid].resetFocusTab(FocusMgr.mresetEle)
                    }
                }
                delete FocusMgr.mresetEle;
                delete FocusMgr.mresetFid;
                delete FocusMgr.mresetWid
            },
            0)
        };
        this.ftExceptionHandler = function(f, d, g, b) {
            if (FocusMgr.mFocusStk.length > 0) {
                FocusMgr.mFocusStk = [];
                FocusMgr.mCurFocusID = g;
                FocusMgr.mCurFocusElement = b;
                FocusMgr.mCurFocusWindowID = d;
                FocusMgr.mUIFocusElement = null;
                FocusMgr.mForceFocusToCurrent = true
            }
            throw f
        };
        this.SetFocusToField = function(g, d) {
            if (! (d in getFields_NS(g))) {
                return
            }
            var o = getFields_NS(g)[d];
            if (!o.GetNestedFocusability()) {
                return
            }
            var q = o.GetParent();
            while (q) {
                if (q instanceof DPage) {
                    q.SelectPageDueToFocusInChildField()
                }
                q = q.GetParent()
            }
            var b = new FormEvent(g, d);
            var h = this.mFocusStk.length;
            if (h > 0) {
                var k = this.mFocusStk[h - 1];
                if (k.ty == 1) {
                    this.mFocusStk.pop();
                    this.mFocusStk.push({
                        ty: 1,
                        id: d,
                        ed: b,
                        fe: b.element,
                        wID: g
                    });
                    return {
                        n: {
                            t: this,
                            f: this.transitionFocus,
                            a: [g, h - 1]
                        }
                    }
                } else {
                    return {
                        n: {
                            t: this,
                            f: this.changeFocusTo,
                            a: [g, d, b, b.element]
                        }
                    }
                }
            } else {
                this.mUIFocusElement = null;
                return {
                    n: {
                        t: this,
                        f: this.changeFocusTo,
                        a: [g, d, b, b.element]
                    }
                }
            }
        };
        this.WorkflowComplete = function(b) {
            var d = getCurWFC_NS(b);
            if (d != null && d == this.mWFC) {
                this.mWFC = null;
                if (this.mCurFocusID != 0 && this.mCurFocusElement != this.mUIFocusElement) {
                    this.mForceFocusToCurrent = true
                }
                this.mUIFocusElement = null
            }
            if (d != null && d.mOpenedWindow) {
                this.mOpenedWindow = true
            }
            if (!this.mOpenedWindow && this.mForceFocusToCurrent) {
                if (this.mTimeoutID == null) {
                    this.mTimeoutID = setTimeout(function() {
                        FocusMgr.mTimeoutID = null;
                        if (getFormContext(b)) {
                            FocusMgr.reallySetFocus(b)
                        }
                    },
                    0)
                }
            }
            if (d != null && d == this.mWFC) {
                if (this.mFocusStk.length > 0) {
                    this.mFocusStk = []
                }
            }
        };
        this.WindowGotFocus = function(b) {
            this.mOpenedWindow = false;
            if (this.mForceFocusToCurrent) {
                this.reallySetFocus(b)
            }
        };
        this.SetFocusToFirst = function(b) {
            var d = getFieldListInfo_NS(b);
            this.setFocusToTabElementFromCur(d.firstField.mObj, true)
        };
        this.SetFocusToLast = function(b) {
            var d = getFieldListInfo_NS(b);
            this.setFocusToTabElementFromCur(d.lastField.mObj, false)
        };
        this.SetFocusToNext = function(b) {
            return this.setFocusToTabElement(b, true)
        };
        this.SetFocusToPrevious = function(b) {
            return this.setFocusToTabElement(b, false)
        };
        this.setFocusToTabElement = function(b, d) {
            this.setFocusToTabElementFromCur(b.element, d)
        };
        this.setFocusToTabElementFromCur = function(g, f) {
            var d = Window_FromElement(g);
            var p = Field_FromElement(g);
            var h;
            var o;
            var k;
            if (f) {
                k = this.getNextFieldOrTBEle;
                o = this.getNextFieldElement;
                h = this.getFirstFieldElement
            } else {
                k = this.getPrevFieldOrTBEle;
                o = this.getPrevFieldElement;
                h = this.getLastFieldElement
            }
            var s = null;
            if (p != null) {
                s = o.call(this, p, g);
                g = p.mObj
            } else {
                if (g == document.body && this.mCurFocusID > 0) {
                    var u = getFields_NS(this.mCurFocusWindowID);
                    g = u[this.mCurFocusID].mObj;
                    if (u[this.mCurFocusID].mPaneltemplate != null) {
                        s = o.call(this, u[this.mCurFocusID], this.mCurFocusElement)
                    }
                }
            }
            while (s == null) {
                var q = k.call(this, g, d);
                if (q instanceof Field) {
                    p = q;
                    s = h.call(this, p);
                    g = p.mObj
                } else {
                    s = q;
                    break
                }
            }
            if (s) {
                if (p) {
                    var b = new FormEvent(p.windowID, p.mID);
                    b.element = s;
                    new WorkflowContext(p.windowID, {
                        t: this,
                        f: this.changeFocusTo,
                        a: [p.windowID, p.mID, b, s]
                    });
                    return true
                } else {
                    setTimeout(function() {
                        s.focus()
                    },
                    0)
                }
            }
            new WorkflowContext(d, {
                t: this,
                f: this.changeFocusTo,
                a: [d, 0, null, null]
            });
            return false
        };
        this.getNextFieldOrTBEle = function(b) {
            return this.nextElementWalker(b, document.body, this, this.fieldOrTBSelector)
        };
        this.getPrevFieldOrTBEle = function(d, b) {
            return this.prevElementWalker(d, this.getStopAtElement(b), this, this.fieldOrTBSelector)
        };
        this.getNextFieldElement = function(d, b) {
            return this.nextElementWalker(b, d.mObj, d, d.TabableElementSelector)
        };
        this.getPrevFieldElement = function(d, b) {
            return this.prevElementWalker(b, d.mObj, d, d.TabableElementSelector)
        };
        this.getFirstFieldElement = function(d) {
            var b = d.TabableElementSelector(d.mObj);
            if (b == null) {
                b = this.nextElementWalker(d.mObj, d.mObj, d, d.TabableElementSelector)
            }
            return b
        };
        this.getLastFieldElement = function(f) {
            var d = f.mObj.lastChild;
            if (d == null) {
                return
            }
            while (d.lastChild && (!d.style || (d.style.visibility != "hidden" && d.style.display != "none"))) {
                d = d.lastChild
            }
            if (d.nodeType == 1) {
                var b = f.TabableElementSelector(d);
                if (b) {
                    return b
                }
            }
            return this.prevElementWalker(d, f.mObj, f, f.TabableElementSelector)
        };
        this.nextElementWalker = function(g, f, h, d) {
            var o = g;
            while (true) {
                var k;
                if (o.firstChild && (!o.style || (o.style.visibility != "hidden" && o.style.display != "none"))) {
                    o = o.firstChild
                } else {
                    if (o == f) {
                        return null
                    }
                    while (!o.nextSibling) {
                        o = o.parentNode;
                        if (o == f || o == null) {
                            return null
                        }
                    }
                    o = o.nextSibling
                }
                if (o.nodeType == 1) {
                    var b;
                    if ((b = d.call(h, o)) != null) {
                        return b
                    }
                }
            }
        };
        this.prevElementWalker = function(g, f, h, d) {
            var o = g;
            if (g == document.body) {
                if (parent != null && "ARProcessEvent" in parent && parent.name != window.name) {
                    return null
                }
                while (o.lastChild && (!o.style || (o.style.visibility != "hidden" && o.style.display != "none"))) {
                    o = o.lastChild
                }
                if (o.nodeType == 1) {
                    var b;
                    if ((b = d.call(h, o)) != null) {
                        return b
                    }
                }
            }
            while (o != f) {
                var k;
                if (o.previousSibling) {
                    o = o.previousSibling;
                    while (o.lastChild && (!o.style || (o.style.visibility != "hidden" && o.style.display != "none"))) {
                        o = o.lastChild
                    }
                } else {
                    o = o.parentNode
                }
                if (o == f) {
                    return null
                }
                if (o.nodeType == 1) {
                    var b;
                    if ((b = d.call(h, o)) != null) {
                        return b
                    }
                }
            }
            return null
        };
        this.fieldOrTBSelector = function(g) {
            var b;
            if ((b = g.getAttribute("arid")) != null && g.style.display != "none" && g.style.visibility != "hidden") {
                var d = g.getAttribute("arwindowid");
                var f = getFields_NS(parseInt(d))[parseInt(b)];
                if (f && f.GetNestedFocusability()) {
                    return f
                }
            }
            if (g.tagName == "A" && g.className && (g.className.indexOf("tbbtn") != -1 || g.className.indexOf("TBTopBarBox") != -1)) {
                return FakeButton_TabableElementSelector(g)
            }
            return null
        };
        this.getStopAtElement = function(d) {
            if (d == 0) {
                return document.body
            }
            var f = wm.getParentWindowID(d);
            var b = getViewFields_NS(f);
            for (var g in b) {
                if (b[g] != null && b[g].isInlineForm() && b[g].mChildWindowID != null && b[g].mChildWindowID == d) {
                    return b[g].mObj
                }
            }
            return document.body
        }
    } ()
}
function arJumpOutForward() {
    if (FocusMgr.mCurFocusID != 0) {
        var b = new FormEvent(FocusMgr.mCurFocusWindowID, FocusMgr.mCurFocusID);
        FocusMgr.SetFocusToNext(b)
    }
}
function arJumpOutBackward() {
    if (FocusMgr.mCurFocusID != 0) {
        var b = new FormEvent(FocusMgr.mCurFocusWindowID, FocusMgr.mCurFocusID);
        b.shift = true;
        FocusMgr.SetFocusToPrevious(b)
    }
}
function Arithmetic(h, f, d, g) {
    if (g) {
        if (! (g in DatatypeFactories)) {
            return Null
        }
        if (f.isNull && d.isNull) {
            return Null
        }
        return (DatatypeFactories[g]())[h](f, d)
    } else {
        if (f instanceof Datatype && d instanceof Datatype) {
            if (f.isNull && d.isNull) {
                return Null
            }
            if (h == "DIV" && f.type == 2 && d.type == 2) {
                var g = 3
            } else {
                if (h == "SUB" && f.type == d.type && (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) | (1 << 13 & (1 << f.type)) | (1 << 14 & (1 << f.type)))) {
                    var g = 2
                } else {
                    var g = f.isNull ? d.type: f.type
                }
            }
            return (DatatypeFactories[g]())[h](f, d)
        } else {
            if (f instanceof Datatype && d == null) {
                var g = f.type;
                return (DatatypeFactories[g]())[h](f)
            }
        }
    }
}
function Relational(h, f, d, g) {
    if (g) {
        if (! (g in DatatypeFactories)) {
            return false
        }
        return (DatatypeFactories[g]())[h](f, d)
    } else {
        if (f instanceof Datatype) {
            return f[h](d)
        }
    }
}
function EQ(f, d, g) {
    return Relational("EQ", f, d, g)
}
function NE(f, d, g) {
    return Relational("NE", f, d, g)
}
function LT(f, d, g) {
    return Relational("LT", f, d, g)
}
function LE(f, d, g) {
    return Relational("LE", f, d, g)
}
function GT(f, d, g) {
    return Relational("GT", f, d, g)
}
function GE(f, d, g) {
    return Relational("GE", f, d, g)
}
function LIKE(f, d, g) {
    return Relational("LIKE", f, d, g)
}
function ADD(f, d, g) {
    return Arithmetic("ADD", f, d, g)
}
function SUB(f, d, g) {
    return Arithmetic("SUB", f, d, g)
}
function MUL(f, d, g) {
    return Arithmetic("MUL", f, d, g)
}
function DIV(f, d, g) {
    return Arithmetic("DIV", f, d, g)
}
function MOD(f, d, g) {
    return Arithmetic("MOD", f, d, g)
}
function NEG(b, d) {
    return Arithmetic("NEG", b, null, d)
}
function HoverState() {
    this.MOFFSETX = 10;
    this.MOFFSETY = 10;
    this.FOCUSNONE = 0;
    this.GAIN = 1;
    this.LOSE = 2;
    this.MOUSEDWNFLD = 1;
    this.MOUSEUPFLD = 2;
    this.MOUSENONEFLD = 0;
    this.init();
    this.mHoverWait = this.getHoverWait();
    this.mFocusEvent = this.FOCUSNONE;
    this.mMouseFld = this.MOUSENONEFLD;
    this.mfocusByKey = false;
    this.mXQTHoverEvent = false;
    this.mButtonEvent = null
}
HoverState.prototype.init = function() {
    this.mTracking = false;
    this.mTrackEvent = null;
    this.mTrackfID = 0;
    this.mTimer = null;
    this.mIgnoreEvent = false
};
HoverState.prototype.getHoverWait = function() {
    var b = ARPrefsGetAsNumber(28514);
    if ((isNaN(b) || b <= 0) && hoverWaitTime != null) {
        b = hoverWaitTime
    }
    return b
};
HoverState.prototype.reset = function() {
    this.init()
};
HoverState.prototype.fieldFromElement = function(h) {
    var k = h.getAttribute("artabid");
    var b;
    if (k == null) {
        var d = h;
        var f = (h.className.indexOf("btn") != -1) ? true: false;
        if (f) {
            d = h.parentNode
        }
        if (d != null) {
            var g = (d.className.indexOf("Tab") != -1) ? true: false;
            if (g) {
                k = d.getAttribute("artabid");
                if (k == null) {
                    d = d.parentNode;
                    if (d != null) {
                        k = d.getAttribute("artabid");
                        if (k != null) {
                            b = d.getAttribute("arwindowid");
                            return getFields_NS(b)[k]
                        }
                    }
                } else {
                    b = d.getAttribute("arwindowid");
                    return getFields_NS(b)[k]
                }
            }
        }
    } else {
        b = d.getAttribute("arwindowid");
        return getFields_NS(b)[k]
    }
    return Field_FromElement(h)
};
HoverState.prototype.fieldDisabled = function(b) {
    if (b.GAccess() == 3) {
        return true
    } else {
        return false
    }
};
HoverState.prototype.checkLocation = function() {
    if (this.mTimer != null) {
        this.mTimer = null;
        this.mIgnoreEvent = true;
        this.triggerEvent(this.mTrackEvent)
    } else {
        this.reset()
    }
};
HoverState.prototype.startTimer = function(d, b) {
    this.mTrackfID = d.mID;
    this.mTracking = true;
    this.mTrackEvent = b;
    this.mTimer = window.setTimeout("hoverState.checkLocation()", this.mHoverWait)
};
HoverState.prototype.clearTracking = function() {
    if (this.mTimer) {
        window.clearTimeout(this.mTimer);
        this.mTimer = null
    }
    this.reset()
};
HoverState.prototype.eventMouseOver = function(b) {
    if (this.mIgnoreEvent) {
        return
    }
    var d = this.fieldFromElement(b.element);
    if (this.fieldDisabled(d)) {
        return
    }
    if (this.mTracking == true) {
        if (this.mTrackfID != d.mID) {
            this.clearTracking();
            this.startTimer(d, b)
        } else {
            if (b.mMouseX == this.mTrackEvent.mMouseX && b.mMouseY == this.mTrackEvent.mMouseY) {
                this.mTrackEvent = b
            } else {
                this.clearTracking();
                this.startTimer(d, b)
            }
        }
    } else {
        this.startTimer(d, b)
    }
    return true
};
HoverState.prototype.eventMouseMove = function(b) {
    if (this.mIgnoreEvent) {
        return
    }
    var d = this.fieldFromElement(b.element);
    if (this.mTracking == true) {
        if (this.mTrackfID != d.mID) {
            this.clearTracking()
        } else {
            this.mTrackEvent = b
        }
    }
    return true
};
HoverState.prototype.eventMouseOut = function(b) {
    if (this.mIgnoreEvent) {
        return
    }
    this.clearTracking()
};
HoverState.prototype.triggerEvent = function(s) {
    var k = this.fieldFromElement(s.element);
    if (k == null) {
        return
    }
    var b = null;
    var p = new Array();
    var o = false;
    if (k.hasChildFields()) {
        if (k instanceof DTable && k.isCustomResultsList()) {
            return
        }
        if (! (k instanceof DTreeView)) {
            var g = k.getChildField(s);
            if (g != null) {
                b = getFields_NS(k.windowID)[g];
                p.push({
                    e: 16777216,
                    f: g,
                    w: k.windowID
                })
            }
            if (k.inDataArea) {
                var h = k.inDataArea(s);
                var d = (h) ? 8388608 : 4194304;
                p.push({
                    e: d,
                    f: k.mID,
                    w: k.windowID
                })
            }
            p.push({
                e: 16777216,
                f: k.mID,
                w: k.windowID
            })
        } else {
            p.push({
                e: 16777216,
                f: k.mID,
                w: k.windowID
            })
        }
    } else {
        o = (k.LocInLabel) ? k.LocInLabel(s) : false;
        var q = (o) ? 4194304 : 8388608;
        p.push({
            e: q,
            f: k.mID,
            w: k.windowID
        });
        p.push({
            e: 16777216,
            f: k.mID,
            w: k.windowID
        })
    }
    this.executeEvent(p)
};
HoverState.prototype.executeEvent = function(h) {
    var d = null;
    var b = -1;
    for (var g = 0; g < h.length; g++) {
        b = g;
        d = AREventFunction(h[g].w, h[g].e, h[g].f);
        if (d != null) {
            break
        }
    }
    if (d) {
        var k = getFields_NS(h[b].w)[h[b].f];
        this.mXQTHoverEvent = true;
        promptBar.setToClear();
        new WorkflowContext(h[b].w, {
            f: executeHover,
            a: [h[b].w, h[b].e, h[b].f]
        })
    } else {
        this.reset()
    }
};
HoverState.prototype.getWindowDims = function() {
    var o = document.body.scrollTop;
    var f = document.body.scrollLeft;
    var k = window.innerHeight + o;
    var b = window.innerWidth + f;
    var g = k - o;
    var d = b - f;
    var h = "getWindowDims(t,l b,r h,w)=(" + o + "," + f + " " + k + "," + b + " " + g + "," + d;
    return {
        top: o,
        left: f,
        bottom: k,
        right: b,
        w: d,
        h: g
    }
};
HoverState.prototype.SetTipPos = function(b, d) {
    b.style.left = d.x + "px";
    b.style.top = d.y + "px"
};
HoverState.prototype.GetTipSize = function(d) {
    var b = new Object();
    b.x = d.clientWidth;
    b.y = d.clientHeight;
    return b
};
HoverState.prototype.AdjustTipRTL = function(b, g) {
    var f = g.x - b.x;
    var d = g.y - b.y;
    f = Math.max(0, f);
    d = Math.max(0, d);
    return {
        x: f,
        y: d
    }
};
HoverState.prototype.calcPos = function(f, C, B, k, g) {
    var v = {
        x: C.x,
        y: C.y
    };
    this.SetTipPos(f, v);
    var q = this.GetTipSize(f);
    if (q != null) {
        var p = g.right;
        var h = g.bottom;
        var A = null;
        var y = null;
        var d = v.x + q.x;
        var w = v.y + q.y;
        if (d >= p) {
            var s = (B != null) ? B.x: v.x;
            s += 2;
            A = s - q.x;
            if (A < 0) {
                A = 0
            }
        } else {
            if (k) {
                v.x -= this.MOFFSETX
            }
        }
        if (w >= h) {
            var o = (B != null) ? B.y: v.y;
            o += 2;
            y = o - q.y;
            if (y < 0) {
                y = 0
            }
        } else {
            if (k) {
                v.y -= this.MOFFSETY
            }
        }
        var b = false;
        if (A != null) {
            v.x = A;
            b = true
        }
        if (y != null) {
            v.y = y;
            b = true
        }
    }
    v.x = Math.max(0, v.x);
    v.y = Math.max(0, v.y);
    if (b && B != null) {
        this.SetTipPos(f, v);
        var u = this.GetTipSize(f);
        if (B.x >= v.x && B.x <= v.x + u.x) {} else {
            var s = B.x + 2;
            v.x = s - u.x
        }
        if (B.y >= v.y && B.y <= v.y + u.y) {} else {
            var o = B.y + 2;
            v.y = o - u.y
        }
    }
    return {
        x: v.x,
        y: v.y
    }
};
HoverState.prototype.getTipLocation = function(b, g) {
    winDim = this.getWindowDims();
    var s = new Object();
    var p = true;
    if (this.mXQTHoverEvent) {
        s.x = this.mTrackEvent.mMouseX - document.body.scrollLeft;
        s.y = this.mTrackEvent.mMouseY - document.body.scrollTop
    } else {
        if (this.mButtonEvent) {
            if (this.buttonActivatedByKey()) {
                s = ComputeElementPosition(this.mButtonEvent.element, document.body, 0, 0);
                var d = this.mButtonEvent.element;
                var f = d.style.width;
                var v = d.style.height;
                var u = -1;
                u = f.indexOf("px");
                if (u != -1) {
                    f = f.substring(0, u)
                }
                u = v.indexOf("px");
                if (u != -1) {
                    v = v.substring(0, u)
                }
                f = parseInt(f);
                v = parseInt(v);
                s.x += f / 2;
                s.y += v / 2;
                p = false
            } else {
                s.x = this.mButtonEvent.mMouseX - document.body.scrollLeft;
                s.y = this.mButtonEvent.mMouseY - document.body.scrollTop
            }
        } else {
            p = false;
            var k, h;
            k = document.body.clientWidth / 2;
            h = document.body.clientHeight / 2;
            var q = this.GetTipSize(b);
            if (q) {
                k -= (q.x / 2);
                h -= (q.y / 2);
                if (k < 0) {
                    k = 0
                }
                if (h < 0) {
                    h = 0
                }
                k = Math.floor(k);
                h = Math.floor(h)
            }
            s.x = k;
            s.y = h
        }
    }
    var w = {
        x: s.x,
        y: s.y
    };
    var o = new Object();
    o = this.calcPos(b, s, (p) ? w: null, g, winDim);
    s = o;
    q = this.GetTipSize(b);
    return {
        pos: {
            x: s.x,
            y: s.y
        },
        tipDims: {
            w: q.x,
            h: q.y
        }
    }
};
HoverState.prototype.btnClickS = function(b) {
    this.mButtonEvent = b
};
HoverState.prototype.btnClickE = function() {
    this.mButtonEvent = null;
    this.reset()
};
HoverState.prototype.afterXQTEvt = function(b) {
    this.mXQTHoverEvent = false;
    this.reset()
};
HoverState.prototype.inEvtHover = function() {
    return this.mXQTHoverEvent
};
HoverState.prototype.inButtonClick = function() {
    return this.mButtonEvent != null
};
HoverState.prototype.buttonActivatedByKey = function() {
    if (this.mButtonEvent == null) {
        return null
    }
    if (this.mButtonEvent.key == 32 || this.mButtonEvent.key == 13) {
        return true
    } else {
        return false
    }
};
HoverState.prototype.getHoverField = function() {
    if (this.mTrackEvent && this.mXQTHoverEvent) {
        return this.fieldFromElement(this.mTrackEvent.element)
    } else {
        return null
    }
};
HoverState.prototype.getClickField = function() {
    if (this.inButtonClick) {
        return this.fieldFromElement(this.mButtonEvent.element)
    } else {
        return null
    }
};
HoverState.prototype.wfMouseDown = function() {
    this.mMouseFld = this.MOUSEDWNFLD
};
HoverState.prototype.wfMouseUp = function() {
    if (toolTip.isDisplayed()) {
        this.mMouseFld = this.MOUSEUPFLD
    } else {
        this.mMouseFld = this.MOUSENONEFLD
    }
};
HoverState.prototype.wfTabStart = function() {
    this.mfocusByKey = true
};
HoverState.prototype.wfTabEnd = function() {
    this.mfocusByKey = false
};
HoverState.prototype.focusEvent = function(b) {
    this.mFocusEvent = b
};
HoverState.prototype.clearFocusEvent = function(b) {
    var d = (this.mFocusEvent == this.GAIN) ? true: false;
    this.mFocusEvent = this.FOCUSNONE;
    if (d) {
        return {
            c: {
                t: FocusMgr,
                f: FocusMgr.resetFocus,
                a: [this.mfocusByKey]
            }
        }
    }
};
HoverState.prototype.getFocusEvent = function() {
    return this.mFocusEvent
};
HoverState.prototype.clickClosedTT = function() {
    if (this.mFocusEvent == this.FOCUSNONE) {
        return true
    }
    if (this.mMouseFld == this.MOUSEUPFLD) {
        this.mMouseFld = this.MOUSENONEFLD;
        return false
    } else {
        return true
    }
};
HoverState.prototype.trackingMouse = function() {
    return this.mTracking
};
HoverState.prototype.hasMouseTrackEvent = function() {
    return this.mTrackEvent != null
};
HoverState.prototype.getHoverFID = function(b, g) {
    if (this.mTracking == true) {
        if (g == this.mTrackfID) {
            return g
        }
        var d = getFields_NS(b)[this.mTrackfID];
        if (d.hasChildFields()) {
            var f = d.isChild(g);
            return (f) ? g: -1
        }
        return - 1
    } else {
        return - 1
    }
};
HoverState.prototype.getHoverValue = function(b, f) {
    if (this.mTracking == true) {
        var d = getFields_NS(b)[f];
        if (d != null) {
            return d.GetHoverValue(this.mTrackEvent)
        }
    }
    return ""
};
HoverState.prototype.hoverByKey = function(b) {
    return true
};
HoverState.prototype.alExecuteHover = function(b, d, f) {
    this.mXQTHoverEvent = false;
    this.mButtonEvent = false;
    return executeHover(b, d, f)
};
HoverState.prototype.StrExecHover = function(b) {
    return null
};
HoverState.prototype.StrDebug = function(b) {};
var hoverState = null;
function executeHover(b, d, f) {
    LogWrite("  executeHover");
    return {
        c: {
            f: ExecuteWorkflow,
            a: [b, d, f]
        },
        n: {
            f: function() {
                hoverState.afterXQTEvt(f)
            }
        }
    }
}
function alExecuteHover(b, d, f) {
    return hoverState.alExecuteHover(b, d, f)
}
function ToolTip() {
    this.mTT = document.getElementById("artooltip");
    this.mDView = new DocView(this.mTT, null, null, true);
    if (arguments.length) {
        this.init()
    }
}
ToolTip.prototype.init = function() {
    this.mTipDisplayed = false
};
ToolTip.prototype.reset = function() {
    this.init();
    this.mTT.onmouseout = null;
    this.mTT.style.visibility = "hidden";
    this.mTT.style.top = 0;
    this.mTT.style.left = 0;
    this.mTT.innerHTML = null;
    this.mTT.blur()
};
ToolTip.prototype.setTipDisplayed = function(d) {
    this.mTipDisplayed = true;
    if ("external" in top) {
        try {
            top.external.ShowToolTip(d)
        } catch(b) {}
    }
};
ToolTip.BackgroundURL = "resources/swf/background.swf?a=0.9&c=ececec&b=014c8d&t=1&";
ToolTip.small = "r=3,3,3,3";
ToolTip.big = "r=8,8,8,8";
ToolTip.prototype.showToolTip = function(b, d) {
    if (d.length == 0) {
        return
    }
    var g = false;
    this.mDView.S(d, g);
    this.mTT.className = (d.match(DocView.HTMLDOCPAT)) ? "divToolTipHtml": "divToolTip";
    var o = hoverState.inEvtHover();
    var q = hoverState.inButtonClick();
    if (o && !hoverState.hasMouseTrackEvent()) {
        hoverState.reset();
        return null
    }
    var p = false;
    if (o) {
        p = true
    }
    if (q && hoverState.buttonActivatedByKey() == false) {
        p = true
    }
    if (o) {
        var k = hoverState.getHoverField();
        if (k) {
            window.setTimeout("toolTip.chgCursor('default')", 100)
        }
    }
    this.setTipDisplayed(d);
    var h = this.mTT;
    window.setTimeout(function() {
        var f = hoverState.getTipLocation(h, p);
        var v = f.pos;
        var s = f.tipDims;
        h.style.left = v.x + "px";
        h.style.top = v.y + "px";
        h.style.visibility = "visible";
        try {
            toolTip.mTT.focus()
        } catch(u) {}
    },
    5);
    if (o) {
        this.mTT.onmouseout = ToolTipMouseClose
    }
    return {
        i: 1
    }
};
ToolTip.prototype.chgCursor = function(b) {
    var d = hoverState.getHoverField();
    if (d) {
        d.mObj.style.cursor = b
    }
};
ToolTip.prototype.EvtInside = function(f) {
    var o = f.mMouseX;
    var k = f.mMouseY;
    var h = this.mTT.style.left;
    var d = this.mTT.style.top;
    var b = -1;
    b = h.indexOf("px");
    if (b != -1) {
        h = h.substring(0, b)
    }
    b = d.indexOf("px");
    if (b != -1) {
        d = d.substring(0, b)
    }
    h = parseInt(h);
    d = parseInt(d);
    var g = h + this.mTT.clientWidth;
    var p = d + this.mTT.clientHeight;
    if (o > (h + 1) && o <= g && k > (d + 1) && k <= p) {
        return true
    } else {
        return false
    }
};
ToolTip.prototype.NotifyClick = function(b) {
    if (this.EvtInside(b)) {
        return 3
    }
    var f = false;
    if (!hoverState.inEvtHover()) {
        f = hoverState.clickClosedTT()
    }
    if (f) {
        ToolTipClose();
        var d = 0;
        if (FakeButton_Find(b.element) != null) {
            d = 1
        }
        return d
    }
    return TTCLICLPASS
};
ToolTip.prototype.EscapeTooltip = function() {
    if (!this.mTipDisplayed) {
        return true
    }
    gTTEscScrollposX = getFormElements_NS(0)["FormContainer"].scrollLeft;
    gTTEscScrollposY = getFormElements_NS(0)["FormContainer"].scrollTop;
    FocusMgr.resettheFocus();
    ToolTipClose();
    return false
};
ToolTip.prototype.isDisplayed = function() {
    return this.mTipDisplayed
};
ToolTip.prototype.StrDebug = function(b) {};
var toolTip = null;
function ToolTipMouseClose(d) {
    var b = new FormEvent(d);
    if (!toolTip.EvtInside(b)) {
        b.PDStopBubbling();
        FocusMgr.resettheFocus();
        ToolTipClose()
    }
}
function ToolTipClose() {
    toolTip.reset();
    if (getCurWFC_NS(getCurrentWindowID_NS())) {
        getCurWFC_NS(getCurrentWindowID_NS()).resume()
    }
}
function TTNotifyClick(b) {
    return toolTip.NotifyClick(b)
}
function EscapeTooltip() {
    return toolTip.EscapeTooltip()
}
function TTisDisplayed() {
    return toolTip.isDisplayed()
}
function TTCloseByClick() {
    if (toolTip.isDisplayed()) {
        if (hoverState.inEvtHover()) {
            return false
        } else {
            return true
        }
    }
    return false
}
Datatype.prototype.constructor = Datatype;
var DatatypeFactories = {};
function Datatype() {}
Datatype.prototype.init = function() {};
Datatype.prototype.type = 0;
Datatype.prototype.args = function() {
    return {}
};
Datatype.prototype.SerializeAsString = function() {
    var f = "{t:" + this.type + ',v:"' + this.toPrimitive().JScriptEncode() + '"';
    if ("args" in this) {
        var b = this.args();
        var d = [];
        for (i in b) {
            d.push(i + ":" + b[i])
        }
        f += ",a:{" + d.join(",") + "}"
    }
    f += "}";
    return f
};
Datatype.prototype.isNull = true;
Datatype.prototype.toInteger = function() {
    var b = new IntegerType(this.toString());
    return b.toInteger()
};
Datatype.prototype.toReal = function() {
    var b = new RealType(LCRealToEn_US(this.toString(), false));
    return b.toReal()
};
Datatype.prototype.toDecimal = function() {
    var b = new DecimalType(LCDecimalToEn_US(this.toString(), false));
    return b.toDecimal()
};
Datatype.prototype.toCurrency = function(b) {
    return new CurrencyType(this.toDecimal(), b)
};
Datatype.prototype.toChar = function() {
    return this.toString()
};
Datatype.prototype.toTOD = function() {
    return new TODType(this.toInteger())
};
Datatype.prototype.toTime = function() {
    return new TimeType(this.toInteger())
};
Datatype.prototype.toDate = function() {
    return new DateType(this.toInteger())
};
Datatype.prototype.toString = function() {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9215)
};
Datatype.prototype.compareValStr = function() {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9215)
};
Datatype.prototype.toAttach = function(b) {
    return new AttachmentType(this.toString())
};
Datatype.prototype.toPrimitive = function() {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9215)
};
Datatype.prototype.toDbgString = function() {
    var b = "dt:{t:" + this.type;
    if ("mValue" in this) {
        b += ",mValue:" + this.mValue
    }
    return b + "}"
};
Datatype.prototype.part = function() {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9215)
};
Datatype.prototype.compound = function(b) {
    return null
};
Datatype.prototype.Diff = function(b) {
    return ! (this.type == b.type && this.mValue == b.mValue)
};
Datatype.prototype.EQ = function(b) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9367)
};
Datatype.prototype.NE = function(b) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9367)
};
Datatype.prototype.LT = function(b) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9367)
};
Datatype.prototype.LE = function(b) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9367)
};
Datatype.prototype.GT = function(b) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9367)
};
Datatype.prototype.GE = function(b) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9367)
};
Datatype.prototype.LIKE = function(b) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9367)
};
Datatype.prototype.ADD = function(f, d) {
    if (d.isNull) {
        return f
    } else {
        if (f.isNull) {
            return d
        }
    }
    getCurWFC_NS(getCurrentWindowID_NS()).status(9339)
};
Datatype.prototype.SUB = function(f, d) {
    if (d.isNull) {
        return f
    } else {
        if (f.isNull) {
            return d
        }
    }
    getCurWFC_NS(getCurrentWindowID_NS()).status(9339)
};
Datatype.prototype.MUL = function(f, d) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9339)
};
Datatype.prototype.DIV = function(f, d) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9339)
};
Datatype.prototype.MOD = function(f, d) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9339)
};
Datatype.prototype.NEG = function(b) {
    getCurWFC_NS(getCurrentWindowID_NS()).status(9339)
};
function Datatype_Factory(b) {
    if (b.t in DatatypeFactories) {
        return DatatypeFactories[b.t](b.v, b.a)
    }
    return Null
}
Datatype.prototype.ROUND = function() {
    var b = this.toReal();
    b = (b > 2147483647) ? 2147483647 : (b < -2147483647) ? -2147483647 : b;
    return new IntegerType(Math.round(b))
};
Datatype.prototype.TRUNC = function() {
    var b = this.toReal();
    b = (b > 2147483647) ? 2147483647 : (b < -2147483647) ? -2147483647 : b;
    return new IntegerType(parseInt(b))
};
Datatype.prototype.EQForSet = function(b) {
    return this.toString() == b.toString()
};
Datatype.prototype.ConvertForPushFields = function(d, b) {
    if (this.isNull) {
        return this
    }
    return DatatypeFactories[d](this, b)
};
Datatype.prototype.ConvertForDynamicPushFields = function(d, b) {
    if (this.isNull || !(b in d)) {
        return this
    }
    return DatatypeFactories[d[b].t](this, d[b].a)
};
NullType.prototype = new Datatype();
NullType.prototype.constructor = NullType;
NullType.superclass = Datatype.prototype;
DatatypeFactories[0] = function(b) {
    return Null
};
function NullType() {
    if (arguments.length) {
        this.init()
    }
}
NullType.prototype.type = 0;
NullType.prototype.isNull = true;
NullType.prototype.toInteger = function() {
    return 0
};
NullType.prototype.toReal = function() {
    return 0
};
NullType.prototype.toString = function() {
    return ""
};
NullType.prototype.compareValStr = function() {
    return this.toString()
};
NullType.prototype.toPrimitive = function() {
    return ""
};
NullType.prototype.part = function() {
    return Null
};
NullType.prototype.compound = function(b) {
    return Null
};
NullType.prototype.ADD = function(b) {
    return b
};
Null = new NullType();
NullType.KEYWORD_NULL = new NullType();
NullType.prototype.EQ = function(b) {
    return b.isNull
};
NullType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
NullType.prototype.GT = function(b) {
    return b.isNull
};
NullType.prototype.LT = function(b) {
    return b.isNull
};
NullType.prototype.GE = function(b) {
    return b.isNull
};
NullType.prototype.LE = function(b) {
    return b.isNull
};
NullType.prototype.LIKE = function(b) {
    return false
};
CharNullType.prototype = new NullType();
CharNullType.prototype.constructor = CharNullType;
CharNullType.superclass = NullType.prototype;
function CharNullType() {
    if (arguments.length) {
        this.init()
    }
}
CharNull = new CharNullType();
CharNullType.KEYWORD_CHAR_NULL = new CharNullType();
NullType.prototype.ROUND = function() {
    return Null
};
NullType.prototype.TRUNC = function() {
    return Null
};
CharType.prototype = new Datatype();
CharType.prototype.constructor = CharType;
CharType.superclass = Datatype.prototype;
DatatypeFactories[4] = function(b) {
    return new CharType(b)
};
function CharType(b) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b)
    }
}
CharType.prototype.init = function(b) {
    if (b instanceof Datatype) {
        this.mValue = b.toChar()
    } else {
        if (typeof b == "string") {
            this.mValue = b
        } else {
            this.mValue = b
        }
    }
};
CharType.prototype.type = 4;
CharType.prototype.isNull = false;
CharType.prototype.toString = function() {
    return this.mValue
};
CharType.prototype.compareValStr = function() {
    return this.toString()
};
CharType.prototype.toPrimitive = function() {
    return this.mValue
};
CharType.prototype.toTime = function() {
    return new TimeType(this.toString())
};
CharType.prototype.toDate = function() {
    return new DateType(this.toString())
};
CharType.prototype.toTOD = function() {
    return new TODType(this.toString())
};
CharType.prototype.ADD = function(f, d) {
    this.mValue = f.toChar() + d.toChar();
    return this
};
CharType.prototype.MOD = function(f, d) {
    if ((1 << 2 & (1 << f.type)) && ((1 << 2 & (1 << d.type)) || (1 << 0 & (1 << d.type)))) {
        if (d.toInteger() == 0) {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9306);
            return
        } else {
            this.mValue = (f.toInteger() % d.toInteger()) + ""
        }
    } else {
        if (d.isNull) {
            return f
        } else {
            if (f.isNull) {
                if (d instanceof IntegerType) {
                    this.mValue = "0"
                } else {
                    return d
                }
            } else {
                getCurWFC_NS(getCurrentWindowID_NS()).status(9339)
            }
        }
    }
    return this
};
CharType.prototype.DIV = function(f, d) {
    if (d.isNull) {
        return f
    } else {
        if (f.isNull) {
            return d
        }
    }
    getCurWFC_NS(getCurrentWindowID_NS()).status(9339)
};
CharType.prototype.MUL = function(f, d) {
    if (d.isNull) {
        return f
    } else {
        if (f.isNull) {
            return d
        }
    }
    getCurWFC_NS(getCurrentWindowID_NS()).status(9339)
};
CharType.prototype.EQ = function(d) {
    if (d.isNull) {
        return false
    }
    var b = this.mValue;
    var f = d.toChar();
    if (getFormElements_NS(getCurrentWindowID_NS())["FormContainer"].getAttribute("arcs") == "1") {
        if (b != null) {
            b = b.toLowerCase()
        }
        if (f != null) {
            f = f.toLowerCase()
        }
    }
    if (b == null || f == null) {
        if (b == null && f == null) {
            return true
        } else {
            return false
        }
    } else {
        return b.localeCompare(f) == 0
    }
};
CharType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
CharType.prototype.GT = function(d) {
    var b = this.mValue;
    var f = d.toChar();
    if (getFormElements_NS(getCurrentWindowID_NS())["FormContainer"].getAttribute("arcs") == "1") {
        if (b != null) {
            b = b.toLowerCase()
        }
        if (f != null) {
            f = f.toLowerCase()
        }
    }
    if (b == null || f == null) {
        if (b == null && f == null) {
            return true
        } else {
            return false
        }
    } else {
        return b.localeCompare(f) > 0
    }
};
CharType.prototype.LT = function(d) {
    var b = this.mValue;
    var f = d.toChar();
    if (getFormElements_NS(getCurrentWindowID_NS())["FormContainer"].getAttribute("arcs") == "1") {
        if (b != null) {
            b = b.toLowerCase()
        }
        if (f != null) {
            f = f.toLowerCase()
        }
    }
    if (b == null || f == null) {
        if (b == null && f == null) {
            return true
        } else {
            return false
        }
    } else {
        return b.localeCompare(f) < 0
    }
};
CharType.prototype.GE = function(d) {
    var b = this.mValue;
    var f = d.toChar();
    if (getFormElements_NS(getCurrentWindowID_NS())["FormContainer"].getAttribute("arcs") == "1") {
        if (b != null) {
            b = b.toLowerCase()
        }
        if (f != null) {
            f = f.toLowerCase()
        }
    }
    if (b == null || f == null) {
        if (b == null && f == null) {
            return true
        } else {
            return false
        }
    } else {
        return b.localeCompare(f) >= 0
    }
};
CharType.prototype.LE = function(d) {
    var b = this.mValue;
    var f = d.toChar();
    if (getFormElements_NS(getCurrentWindowID_NS())["FormContainer"].getAttribute("arcs") == "1") {
        if (b != null) {
            b = b.toLowerCase()
        }
        if (f != null) {
            f = f.toLowerCase()
        }
    }
    if (b == null || f == null) {
        if (b == null && f == null) {
            return true
        } else {
            return false
        }
    } else {
        return b.localeCompare(f) <= 0
    }
};
CharType.prototype.LIKE = function(d) {
    var b = this.mValue;
    var h = d.toChar();
    if (b == null || h == null) {
        return false
    }
    if (getFormElements_NS(getCurrentWindowID_NS())["FormContainer"].getAttribute("arcs") == "1") {
        b = b.toLowerCase();
        h = h.toLowerCase()
    }
    h = h.replace(/(%)|(_)|(\[.*?\])|([.$^+?*{()\\\/|[\]])/gm,
    function(k, s, q, p, o) {
        if (s) {
            return "(.|\\n)*"
        } else {
            if (q) {
                return "(.|\\n)"
            } else {
                if (p) {
                    return p
                } else {
                    if (o) {
                        return "\\" + o
                    }
                }
            }
        }
    });
    try {
        var g = new RegExp("^" + h + "$")
    } catch(f) {
        return false
    }
    return b.match(g) != null
};
CharType.prototype.toCurrency = function(b) {
    return new CurrencyType(this.toString(), b, true)
};
DiaryType.prototype = new CharType();
DiaryType.prototype.constructor = DiaryType;
DiaryType.superclass = CharType.prototype;
DatatypeFactories[5] = function(b) {
    return new DiaryType(b)
};
function DiaryType(b) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b)
    }
}
DiaryType.prototype.init = function(b) {
    DiaryType.superclass.init.call(this, b)
};
DiaryType.prototype.type = 5;
DiaryType.prototype.toCurrency = function(b) {
    return new CurrencyType(this.toString(), b, true)
};
ColumnType.prototype = new Datatype();
ColumnType.prototype.constructor = ColumnType;
ColumnType.superclass = Datatype.prototype;
function ColumnType(b) {
    if (arguments.length) {
        this.init(b)
    }
}
ColumnType.prototype.init = function(b) {
    ColumnType.superclass.init.call(this);
    this.mValue = b
};
MathContext.prototype.getDigits = function() {
    return this.digits
};
MathContext.prototype.getForm = function() {
    return this.form
};
MathContext.prototype.getLostDigits = function() {
    return this.lostDigits
};
MathContext.prototype.getRoundingMode = function() {
    return this.roundingMode
};
MathContext.prototype.toString = function() {
    var g = null;
    var f = 0;
    var d = null;
    if (this.form == 1) {
        g = "SCIENTIFIC"
    } else {
        if (this.form == 2) {
            g = "ENGINEERING"
        } else {
            g = "PLAIN"
        }
    }
    var b = this.ROUNDS.length;
    f = 0;
    f: for (; b > 0; b--, f++) {
        if (this.roundingMode == this.ROUNDS[f]) {
            d = this.ROUNDWORDS[f];
            break f
        }
    }
    return "digits=" + this.digits + " form=" + g + " lostDigits=" + (this.lostDigits ? "1": "0") + " roundingMode=" + d
};
MathContext.prototype.isValidRound = function(d) {
    var b = 0;
    var f = this.ROUNDS.length;
    b = 0;
    b: for (; f > 0; f--, b++) {
        if (d == this.ROUNDS[b]) {
            return true
        }
    }
    return false
};
MathContext.prototype.ROUNDS = new Array(4, 7, 2, 1, 3, 5, 6, 0);
MathContext.prototype.ROUNDWORDS = new Array("ROUND_HALF_UP", "ROUND_UNNECESSARY", "ROUND_CEILING", "ROUND_DOWN", "ROUND_FLOOR", "ROUND_HALF_DOWN", "ROUND_HALF_EVEN", "ROUND_UP");
function MathContext() {
    this.digits = 0;
    this.form = 0;
    this.lostDigits = false;
    this.roundingMode = 0;
    var b = 1;
    var g = false;
    var f = 4;
    if (MathContext.arguments.length == 4) {
        b = MathContext.arguments[1];
        g = MathContext.arguments[2];
        f = MathContext.arguments[3]
    } else {
        if (MathContext.arguments.length == 3) {
            b = MathContext.arguments[1];
            g = MathContext.arguments[2]
        } else {
            if (MathContext.arguments.length == 2) {
                b = MathContext.arguments[1]
            } else {
                if (MathContext.arguments.length != 1) {
                    throw "MathContext(): " + MathContext.arguments.length + " arguments given; expected 1 to 4"
                }
            }
        }
    }
    var d = MathContext.arguments[0];
    if (d != 9) {
        if (d < 0) {
            throw "MathContext(): Digits too small: " + d
        }
        if (d > 999999999) {
            throw "MathContext(): Digits too large: " + d
        }
    }
    if (b == 1) {} else {
        if (b == 2) {} else {
            if (b == 0) {} else {
                throw "MathContext() Bad form value: " + b
            }
        }
    }
    if ((! (this.isValidRound(f)))) {
        throw "MathContext(): Bad roundingMode value: " + f
    }
    this.digits = d;
    this.form = b;
    this.lostDigits = g;
    this.roundingMode = f;
    return
}
BigDecimal.div = function(f, d) {
    return (f - (f % d)) / d
};
BigDecimal.prototype.arraycopy = function arraycopy(k, h, b, g, f) {
    var d;
    if (g > h) {
        for (d = f - 1; d >= 0; --d) {
            b[d + g] = k[d + h]
        }
    } else {
        for (d = 0; d < f; ++d) {
            b[d + g] = k[d + h]
        }
    }
};
BigDecimal.prototype.createArrayWithZeros = function createArrayWithZeros(d) {
    var f = new Array(d);
    var b;
    for (b = 0; b < d; ++b) {
        f[b] = 0
    }
    return f
};
BigDecimal.prototype.add = function() {
    var s;
    if (arguments.length == 2) {
        s = arguments[1]
    } else {
        if (arguments.length == 1) {
            s = this.plainMC()
        } else {
            throw "add(): " + arguments.length + " arguments given; expected 1 or 2"
        }
    }
    var b = arguments[0];
    var B;
    var d;
    var D;
    var g;
    var C;
    var E;
    var y;
    var p = 0;
    var f = 0;
    var h = 0;
    var q = null;
    var A = 0;
    var w = 0;
    var o = 0;
    var k = 0;
    var v = 0;
    var u = 0;
    if (s.lostDigits) {
        this.checkdigits(b, s.digits)
    }
    B = this;
    if (B.ind == 0) {
        if (s.form != 0) {
            return b.plus(s)
        }
    }
    if (b.ind == 0) {
        if (s.form != 0) {
            return B.plus(s)
        }
    }
    d = s.digits;
    if (d > 0) {
        if (B.mant.length > d) {
            B = this.clone(B).round(s)
        }
        if (b.mant.length > d) {
            b = this.clone(b).round(s)
        }
    }
    D = new BigDecimal();
    g = B.mant;
    C = B.mant.length;
    E = b.mant;
    y = b.mant.length;
    padder: do {
        if (B.exp == b.exp) {
            D.exp = B.exp
        } else {
            if (B.exp > b.exp) {
                p = (C + B.exp) - b.exp;
                if (p >= ((y + d) + 1)) {
                    if (d > 0) {
                        D.mant = g;
                        D.exp = B.exp;
                        D.ind = B.ind;
                        if (C < d) {
                            D.mant = this.extend(B.mant, d);
                            D.exp = D.exp - ((d - C))
                        }
                        return D.finish(s, false)
                    }
                }
                D.exp = b.exp;
                if (p > (d + 1)) {
                    if (d > 0) {
                        f = (p - d) - 1;
                        y = y - f;
                        D.exp = D.exp + f;
                        p = d + 1
                    }
                }
                if (p > C) {
                    C = p
                }
            } else {
                p = (y + b.exp) - B.exp;
                if (p >= ((C + d) + 1)) {
                    if (d > 0) {
                        D.mant = E;
                        D.exp = b.exp;
                        D.ind = b.ind;
                        if (y < d) {
                            D.mant = this.extend(b.mant, d);
                            D.exp = D.exp - ((d - y))
                        }
                        return D.finish(s, false)
                    }
                }
                D.exp = B.exp;
                if (p > (d + 1)) {
                    if (d > 0) {
                        f = (p - d) - 1;
                        C = C - f;
                        D.exp = D.exp + f;
                        p = d + 1
                    }
                }
                if (p > y) {
                    y = p
                }
            }
        }
    } while ( false );
    if (B.ind == this.iszero) {
        D.ind = this.ispos
    } else {
        D.ind = B.ind
    }
    if (((B.ind == this.isneg) ? 1 : 0) == ((b.ind == this.isneg) ? 1 : 0)) {
        h = 1
    } else {
        signdiff: do {
            h = -1;
            swaptest: do {
                if (b.ind == this.iszero) {} else {
                    if ((C < y) || (B.ind == this.iszero)) {
                        q = g;
                        g = E;
                        E = q;
                        f = C;
                        C = y;
                        y = f;
                        D.ind = -D.ind
                    } else {
                        if (C > y) {} else {
                            A = 0;
                            w = 0;
                            o = g.length - 1;
                            k = E.length - 1;
                            compare: for (;;) {
                                if (A <= o) {
                                    v = g[A]
                                } else {
                                    if (w > k) {
                                        if (s.form != 0) {
                                            return this.ZERO
                                        }
                                        break compare
                                    }
                                    v = 0
                                }
                                if (w <= k) {
                                    u = E[w]
                                } else {
                                    u = 0
                                }
                                if (v != u) {
                                    if (v < u) {
                                        q = g;
                                        g = E;
                                        E = q;
                                        f = C;
                                        C = y;
                                        y = f;
                                        D.ind = -D.ind
                                    }
                                    break compare
                                }
                                A++;
                                w++
                            }
                        }
                    }
                }
            } while ( false )
        } while ( false )
    }
    D.mant = this.byteaddsub(g, C, E, y, h, false);
    return D.finish(s, false)
};
BigDecimal.prototype.compareTo = function() {
    var k;
    if (arguments.length == 2) {
        k = arguments[1]
    } else {
        if (arguments.length == 1) {
            k = this.plainMC()
        } else {
            throw "compareTo(): " + arguments.length + " arguments given; expected 1 or 2"
        }
    }
    var h = arguments[0];
    var g = 0;
    var b = 0;
    var f;
    if (k.lostDigits) {
        this.checkdigits(h, k.digits)
    }
    if ((this.ind == h.ind) && (this.exp == h.exp)) {
        g = this.mant.length;
        if (g < h.mant.length) {
            return - this.ind
        }
        if (g > h.mant.length) {
            return this.ind
        }
        if ((g <= k.digits) || (k.digits == 0)) {
            var d = g;
            b = 0;
            b: for (; d > 0; d--, b++) {
                if (this.mant[b] < h.mant[b]) {
                    return - this.ind
                }
                if (this.mant[b] > h.mant[b]) {
                    return this.ind
                }
            }
            return 0
        }
    } else {
        if (this.ind < h.ind) {
            return - 1
        }
        if (this.ind > h.ind) {
            return 1
        }
    }
    f = this.clone(h);
    f.ind = -f.ind;
    return this.add(f, k).ind
};
BigDecimal.prototype.divide = function() {
    var f;
    var b = -1;
    if (arguments.length == 2) {
        if (typeof arguments[1] == "number") {
            f = new MathContext(0, 0, false, arguments[1])
        } else {
            f = arguments[1]
        }
    } else {
        if (arguments.length == 3) {
            b = arguments[1];
            if (b < 0) {
                throw "divide(): Negative scale: " + b
            }
            f = new MathContext(0, 0, false, arguments[2])
        } else {
            if (arguments.length == 1) {
                f = this.plainMC()
            } else {
                throw "divide(): " + arguments.length + " arguments given; expected between 1 and 3"
            }
        }
    }
    var d = arguments[0];
    return this.dodivide("D", d, f, b)
};
BigDecimal.prototype.max = function() {
    var d;
    if (arguments.length == 2) {
        d = arguments[1]
    } else {
        if (arguments.length == 1) {
            d = this.plainMC()
        } else {
            throw "max(): " + arguments.length + " arguments given; expected 1 or 2"
        }
    }
    var b = arguments[0];
    if ((this.compareTo(b, d)) >= 0) {
        return this.plus(d)
    } else {
        return b.plus(d)
    }
};
BigDecimal.prototype.min = function() {
    var d;
    if (arguments.length == 2) {
        d = arguments[1]
    } else {
        if (arguments.length == 1) {
            d = this.plainMC()
        } else {
            throw "min(): " + arguments.length + " arguments given; expected 1 or 2"
        }
    }
    var b = arguments[0];
    if ((this.compareTo(b, d)) <= 0) {
        return this.plus(d)
    } else {
        return b.plus(d)
    }
};
BigDecimal.prototype.multiply = function() {
    var v;
    if (arguments.length == 2) {
        v = arguments[1]
    } else {
        if (arguments.length == 1) {
            v = this.plainMC()
        } else {
            throw "multiply(): " + arguments.length + " arguments given; expected 1 or 2"
        }
    }
    var p = arguments[0];
    var g;
    var u;
    var o;
    var f = null;
    var w = null;
    var q;
    var y = 0;
    var s;
    var h;
    var d = 0;
    var k = 0;
    if (v.lostDigits) {
        this.checkdigits(p, v.digits)
    }
    g = this;
    u = 0;
    o = v.digits;
    if (o > 0) {
        if (g.mant.length > o) {
            g = this.clone(g).round(v)
        }
        if (p.mant.length > o) {
            p = this.clone(p).round(v)
        }
    } else {
        if (g.exp > 0) {
            u = u + g.exp
        }
        if (p.exp > 0) {
            u = u + p.exp
        }
    }
    if (g.mant.length < p.mant.length) {
        f = g.mant;
        w = p.mant
    } else {
        f = p.mant;
        w = g.mant
    }
    q = (f.length + w.length) - 1;
    if ((f[0] * w[0]) > 9) {
        y = q + 1
    } else {
        y = q
    }
    s = new BigDecimal();
    h = this.createArrayWithZeros(y);
    var b = f.length;
    d = 0;
    d: for (; b > 0; b--, d++) {
        k = f[d];
        if (k != 0) {
            h = this.byteaddsub(h, h.length, w, q, k, true)
        }
        q--
    }
    s.ind = g.ind * p.ind;
    s.exp = (g.exp + p.exp) - u;
    if (u == 0) {
        s.mant = h
    } else {
        s.mant = this.extend(h, h.length + u)
    }
    return s.finish(v, false)
};
BigDecimal.prototype.negate = function() {
    var d;
    if (arguments.length == 1) {
        d = arguments[0]
    } else {
        if (arguments.length == 0) {
            d = this.plainMC()
        } else {
            throw "negate(): " + arguments.length + " arguments given; expected 0 or 1"
        }
    }
    var b;
    if (d.lostDigits) {
        this.checkdigits(null, d.digits)
    }
    b = this.clone(this);
    b.ind = -b.ind;
    return b.finish(d, false)
};
BigDecimal.prototype.plus = function() {
    var b;
    if (arguments.length == 1) {
        b = arguments[0]
    } else {
        if (arguments.length == 0) {
            b = this.plainMC()
        } else {
            throw "plus(): " + arguments.length + " arguments given; expected 0 or 1"
        }
    }
    if (b.lostDigits) {
        this.checkdigits(null, b.digits)
    }
    if (b.form == 0) {
        if (this.form == 0) {
            if (this.mant.length <= b.digits) {
                return this
            }
            if (b.digits == 0) {
                return this
            }
        }
    }
    return this.clone(this).finish(b, false)
};
BigDecimal.prototype.subtract = function() {
    var f;
    if (arguments.length == 2) {
        f = arguments[1]
    } else {
        if (arguments.length == 1) {
            f = this.plainMC()
        } else {
            throw "subtract(): " + arguments.length + " arguments given; expected 1 or 2"
        }
    }
    var d = arguments[0];
    var b;
    if (f.lostDigits) {
        this.checkdigits(d, f.digits)
    }
    b = this.clone(d);
    b.ind = -b.ind;
    return this.add(b, f)
};
BigDecimal.prototype.equals = function(h) {
    var o;
    var f = 0;
    var k = null;
    var g = null;
    if (h == null) {
        return false
    }
    if ((! (((h instanceof BigDecimal))))) {
        return false
    }
    o = h;
    if (this.ind != o.ind) {
        return false
    }
    if (((this.mant.length == o.mant.length) && (this.exp == o.exp)) && (this.form == o.form)) {
        var d = this.mant.length;
        f = 0;
        f: for (; d > 0; d--, f++) {
            if (this.mant[f] != o.mant[f]) {
                return false
            }
        }
    } else {
        k = this.layout();
        g = o.layout();
        if (k.length != g.length) {
            return false
        }
        var b = k.length;
        f = 0;
        f: for (; b > 0; b--, f++) {
            if (k[f] != g[f]) {
                return false
            }
        }
    }
    return true
};
BigDecimal.prototype.format = function() {
    var J;
    var k;
    var f;
    var g;
    if (arguments.length == 6) {
        J = arguments[2];
        k = arguments[3];
        f = arguments[4];
        g = arguments[5]
    } else {
        if (arguments.length == 2) {
            J = -1;
            k = -1;
            f = 1;
            g = 4
        } else {
            throw "format(): " + arguments.length + " arguments given; expected 2 or 6"
        }
    }
    var C = arguments[0];
    var h = arguments[1];
    var q;
    var d = 0;
    var o = 0;
    var L = 0;
    var b = null;
    var H = 0;
    var y = 0;
    var v = 0;
    var N;
    var G = 0;
    var I = null;
    var K = 0;
    var B = 0;
    if ((C < ( - 1)) || (C == 0)) {
        this.badarg("format", 1, C)
    }
    if (h < ( - 1)) {
        this.badarg("format", 2, h)
    }
    if ((J < ( - 1)) || (J == 0)) {
        this.badarg("format", 3, J)
    }
    if (k < ( - 1)) {
        this.badarg("format", 4, k)
    }
    if (f == 1) {} else {
        if (f == 2) {} else {
            if (f == ( - 1)) {
                f = 1
            } else {
                this.badarg("format", 5, f)
            }
        }
    }
    if (g != 4) {
        try {
            if (g == ( - 1)) {
                g = 4
            } else {
                new MathContext(9, 1, false, g)
            }
        } catch(E) {
            this.badarg("format", 6, g)
        }
    }
    q = this.clone(this);
    setform: do {
        if (k == ( - 1)) {
            q.form = 0
        } else {
            if (q.ind == this.iszero) {
                q.form = 0
            } else {
                d = q.exp + q.mant.length;
                if (d > k) {
                    q.form = f
                } else {
                    if (d < ( - 5)) {
                        q.form = f
                    } else {
                        q.form = 0
                    }
                }
            }
        }
    } while ( false );
    if (h >= 0) {
        setafter: for (;;) {
            if (q.form == 0) {
                o = -q.exp
            } else {
                if (q.form == 1) {
                    o = q.mant.length - 1
                } else {
                    L = (((q.exp + q.mant.length) - 1)) % 3;
                    if (L < 0) {
                        L = 3 + L
                    }
                    L++;
                    if (L >= q.mant.length) {
                        o = 0
                    } else {
                        o = q.mant.length - L
                    }
                }
            }
            if (o == h) {
                break setafter
            }
            if (o < h) {
                b = this.extend(q.mant, (q.mant.length + h) - o);
                q.mant = b;
                q.exp = q.exp - ((h - o));
                if (q.exp < this.MinExp) {
                    throw "format(): Exponent Overflow: " + q.exp
                }
                break setafter
            }
            H = o - h;
            if (H > q.mant.length) {
                q.mant = this.ZERO.mant;
                q.ind = this.iszero;
                q.exp = 0;
                continue setafter
            }
            y = q.mant.length - H;
            v = q.exp;
            q.round(y, g);
            if ((q.exp - v) == H) {
                break setafter
            }
        }
    }
    N = q.layout();
    if (C > 0) {
        var D = N.length;
        G = 0;
        G: for (; D > 0; D--, G++) {
            if (N[G] == ".") {
                break G
            }
            if (N[G] == "E") {
                break G
            }
        }
        if (G > C) {
            this.badarg("format", 1, C)
        }
        if (G < C) {
            I = new Array((N.length + C) - G);
            var A = C - G;
            K = 0;
            K: for (; A > 0; A--, K++) {
                I[K] = " "
            }
            this.arraycopy(N, 0, I, K, N.length);
            N = I
        }
    }
    if (J > 0) {
        var w = N.length - 1;
        G = N.length - 1;
        G: for (; w > 0; w--, G--) {
            if (N[G] == "E") {
                break G
            }
        }
        if (G == 0) {
            I = new Array((N.length + J) + 2);
            this.arraycopy(N, 0, I, 0, N.length);
            var u = J + 2;
            K = N.length;
            K: for (; u > 0; u--, K++) {
                I[K] = " "
            }
            N = I
        } else {
            B = (N.length - G) - 2;
            if (B > J) {
                this.badarg("format", 3, J)
            }
            if (B < J) {
                I = new Array((N.length + J) - B);
                this.arraycopy(N, 0, I, 0, G + 2);
                var s = J - B;
                K = G + 2;
                K: for (; s > 0; s--, K++) {
                    I[K] = "0"
                }
                this.arraycopy(N, G + 2, I, K, B);
                N = I
            }
        }
    }
    return N.join("")
};
BigDecimal.prototype.intValueExact = function() {
    var h;
    var f = 0;
    var b;
    var d = 0;
    var k = 0;
    if (this.ind == this.iszero) {
        return 0
    }
    h = this.mant.length - 1;
    if (this.exp < 0) {
        h = h + this.exp;
        if ((! (this.allzero(this.mant, h + 1)))) {
            throw "intValueExact(): Decimal part non-zero: " + this.toString()
        }
        if (h < 0) {
            return 0
        }
        f = 0
    } else {
        if ((this.exp + h) > 9) {
            throw "intValueExact(): Conversion overflow: " + this.toString()
        }
        f = this.exp
    }
    b = 0;
    var g = h + f;
    d = 0;
    d: for (; d <= g; d++) {
        b = b * 10;
        if (d <= h) {
            b = b + this.mant[d]
        }
    }
    if ((h + f) == 9) {
        k = BigDecimal.div(b, 1000000000);
        if (k != this.mant[0]) {
            if (b == -2147483648) {
                if (this.ind == this.isneg) {
                    if (this.mant[0] == 2) {
                        return b
                    }
                }
            }
            throw "intValueExact(): Conversion overflow: " + this.toString()
        }
    }
    if (this.ind == this.ispos) {
        return b
    }
    return - b
};
BigDecimal.prototype.movePointLeft = function(d) {
    var b;
    b = this.clone(this);
    b.exp = b.exp - d;
    return b.finish(this.plainMC(), false)
};
BigDecimal.prototype.movePointRight = function(d) {
    var b;
    b = this.clone(this);
    b.exp = b.exp + d;
    return b.finish(this.plainMC(), false)
};
BigDecimal.prototype.scale = function() {
    if (this.exp >= 0) {
        return 0
    }
    return - this.exp
};
BigDecimal.prototype.setScale = function() {
    var d;
    if (arguments.length == 2) {
        d = arguments[1]
    } else {
        if (arguments.length == 1) {
            d = 7
        } else {
            throw "setScale(): " + arguments.length + " given; expected 1 or 2"
        }
    }
    var k = arguments[0];
    var b;
    var f;
    var g = 0;
    var h = 0;
    b = this.scale();
    if (b == k) {
        if (this.form == 0) {
            return this
        }
    }
    f = this.clone(this);
    if (b <= k) {
        if (b == 0) {
            g = f.exp + k
        } else {
            g = k - b
        }
        f.mant = this.extend(f.mant, f.mant.length + g);
        f.exp = -k
    } else {
        if (k < 0) {
            throw "setScale(): Negative scale: " + k
        }
        h = f.mant.length - ((b - k));
        f = f.round(h, d);
        if (f.exp != ( - k)) {
            f.mant = this.extend(f.mant, f.mant.length + 1);
            f.exp = f.exp - 1
        }
    }
    f.form = 0;
    return f
};
BigDecimal.prototype.signum = function() {
    return this.ind
};
BigDecimal.prototype.toString = function() {
    return this.layout().join("")
};
BigDecimal.prototype.layout = function() {
    var w;
    var k = 0;
    var v = null;
    var u = 0;
    var y = 0;
    var s = 0;
    var h = null;
    var q;
    var o;
    var p = 0;
    w = new Array(this.mant.length);
    var g = this.mant.length;
    k = 0;
    k: for (; g > 0; g--, k++) {
        w[k] = this.mant[k] + ""
    }
    if (this.form != 0) {
        v = "";
        if (this.ind == this.isneg) {
            v += "-"
        }
        u = (this.exp + w.length) - 1;
        if (this.form == 1) {
            v += w[0];
            if (w.length > 1) {
                v += "."
            }
            v += w.slice(1).join("")
        } else {
            engineering: do {
                y = u % 3;
                if (y < 0) {
                    y = 3 + y
                }
                u = u - y;
                y++;
                if (y >= w.length) {
                    v += w.join("");
                    var d = y - w.length;
                    for (; d > 0; d--) {
                        v += "0"
                    }
                } else {
                    v += w.slice(0, y).join("");
                    v += ".";
                    v += w.slice(y).join("")
                }
            } while ( false )
        }
        if (u != 0) {
            if (u < 0) {
                s = "-";
                u = -u
            } else {
                s = "+"
            }
            v += "E";
            v += s;
            v += u
        }
        return v.split("")
    }
    if (this.exp == 0) {
        if (this.ind >= 0) {
            return w
        }
        h = new Array(w.length + 1);
        h[0] = "-";
        this.arraycopy(w, 0, h, 1, w.length);
        return h
    }
    q = ((this.ind == this.isneg) ? 1 : 0);
    o = this.exp + w.length;
    if (o < 1) {
        p = (q + 2) - this.exp;
        h = new Array(p);
        if (q != 0) {
            h[0] = "-"
        }
        h[q] = "0";
        h[q + 1] = ".";
        var f = -o;
        k = q + 2;
        k: for (; f > 0; f--, k++) {
            h[k] = "0"
        }
        this.arraycopy(w, 0, h, (q + 2) - o, w.length);
        return h
    }
    if (o > w.length) {
        p = q + o;
        h = new Array(p);
        if (q != 0) {
            h[0] = "-"
        }
        this.arraycopy(w, 0, h, q, w.length);
        var b = o - w.length;
        k = q + w.length;
        k: for (; b > 0; b--, k++) {
            h[k] = "0"
        }
        return h
    }
    p = (q + 1) + w.length;
    h = new Array(p);
    if (q != 0) {
        h[0] = "-"
    }
    this.arraycopy(w, 0, h, q, o);
    h[q + o] = ".";
    this.arraycopy(w, o, h, (q + o) + 1, w.length - o);
    return h
};
BigDecimal.prototype.intcheck = function(f, b) {
    var d;
    d = this.intValueExact();
    if ((d < f) || (d > b)) {
        throw "intcheck(): Conversion overflow: " + d
    }
    return d
};
BigDecimal.prototype.dodivide = function(g, b, D, P) {
    var H;
    var f;
    var N;
    var Q;
    var B;
    var R;
    var p;
    var O;
    var y;
    var q;
    var s;
    var G = 0;
    var I = 0;
    var o = 0;
    var A = 0;
    var w = 0;
    var v = 0;
    var E = 0;
    var L = 0;
    var u = null;
    var C = 0;
    var k = 0;
    var h = null;
    if (D.lostDigits) {
        this.checkdigits(b, D.digits)
    }
    H = this;
    if (b.ind == 0) {
        throw "dodivide(): Divide by 0"
    }
    if (H.ind == 0) {
        if (D.form != 0) {
            return this.ZERO
        }
        if (P == ( - 1)) {
            return H
        }
        return H.setScale(P)
    }
    f = D.digits;
    if (f > 0) {
        if (H.mant.length > f) {
            H = this.clone(H).round(D)
        }
        if (b.mant.length > f) {
            b = this.clone(b).round(D)
        }
    } else {
        if (P == ( - 1)) {
            P = H.scale()
        }
        f = H.mant.length;
        if (P != ( - H.exp)) {
            f = (f + P) + H.exp
        }
        f = (f - ((b.mant.length - 1))) - b.exp;
        if (f < H.mant.length) {
            f = H.mant.length
        }
        if (f < b.mant.length) {
            f = b.mant.length
        }
    }
    N = ((H.exp - b.exp) + H.mant.length) - b.mant.length;
    if (N < 0) {
        if (g != "D") {
            if (g == "I") {
                return this.ZERO
            }
            return this.clone(H).finish(D, false)
        }
    }
    Q = new BigDecimal();
    Q.ind = (H.ind * b.ind);
    Q.exp = N;
    Q.mant = this.createArrayWithZeros(f + 1);
    B = (f + f) + 1;
    R = this.extend(H.mant, B);
    p = B;
    O = b.mant;
    y = B;
    q = (O[0] * 10) + 1;
    if (O.length > 1) {
        q = q + O[1]
    }
    s = 0;
    outer: for (;;) {
        G = 0;
        inner: for (;;) {
            if (p < y) {
                break inner
            }
            if (p == y) {
                compare: do {
                    var K = p;
                    I = 0;
                    I: for (; K > 0; K--, I++) {
                        if (I < O.length) {
                            o = O[I]
                        } else {
                            o = 0
                        }
                        if (R[I] < o) {
                            break inner
                        }
                        if (R[I] > o) {
                            break compare
                        }
                    }
                    G++;
                    Q.mant[s] = G;
                    s++;
                    R[0] = 0;
                    break outer
                } while ( false );
                A = R[0]
            } else {
                A = R[0] * 10;
                if (p > 1) {
                    A = A + R[1]
                }
            }
            w = BigDecimal.div((A * 10), q);
            if (w == 0) {
                w = 1
            }
            G = G + w;
            R = this.byteaddsub(R, p, O, y, -w, true);
            if (R[0] != 0) {
                continue inner
            }
            var J = p - 2;
            v = 0;
            v: for (; v <= J; v++) {
                if (R[v] != 0) {
                    break v
                }
                p--
            }
            if (v == 0) {
                continue inner
            }
            this.arraycopy(R, v, R, 0, p)
        }
        if ((s != 0) || (G != 0)) {
            Q.mant[s] = G;
            s++;
            if (s == (f + 1)) {
                break outer
            }
            if (R[0] == 0) {
                break outer
            }
        }
        if (P >= 0) {
            if (( - Q.exp) > P) {
                break outer
            }
        }
        if (g != "D") {
            if (Q.exp <= 0) {
                break outer
            }
        }
        Q.exp = Q.exp - 1;
        y--
    }
    if (s == 0) {
        s = 1
    }
    if ((g == "I") || (g == "R")) {
        if ((s + Q.exp) > f) {
            throw "dodivide(): Integer overflow"
        }
        if (g == "R") {
            remainder: do {
                if (Q.mant[0] == 0) {
                    return this.clone(H).finish(D, false)
                }
                if (R[0] == 0) {
                    return this.ZERO
                }
                Q.ind = H.ind;
                E = ((f + f) + 1) - H.mant.length;
                Q.exp = (Q.exp - E) + H.exp;
                L = p;
                I = L - 1;
                I: for (; I >= 1; I--) {
                    if (! ((Q.exp < H.exp) && (Q.exp < b.exp))) {
                        break
                    }
                    if (R[I] != 0) {
                        break I
                    }
                    L--;
                    Q.exp = Q.exp + 1
                }
                if (L < R.length) {
                    u = new Array(L);
                    this.arraycopy(R, 0, u, 0, L);
                    R = u
                }
                Q.mant = R;
                return Q.finish(D, false)
            } while ( false )
        }
    } else {
        if (R[0] != 0) {
            C = Q.mant[s - 1];
            if (((C % 5)) == 0) {
                Q.mant[s - 1] = (C + 1)
            }
        }
    }
    if (P >= 0) {
        scaled: do {
            if (s != Q.mant.length) {
                Q.exp = Q.exp - ((Q.mant.length - s))
            }
            k = Q.mant.length - ((( - Q.exp) - P));
            Q.round(k, D.roundingMode);
            if (Q.exp != ( - P)) {
                Q.mant = this.extend(Q.mant, Q.mant.length + 1);
                Q.exp = Q.exp - 1
            }
            return Q.finish(D, true)
        } while ( false )
    }
    if (s == Q.mant.length) {
        Q.round(D);
        s = f
    } else {
        if (Q.mant[0] == 0) {
            return this.ZERO
        }
        h = new Array(s);
        this.arraycopy(Q.mant, 0, h, 0, s);
        Q.mant = h
    }
    return Q.finish(D, true)
};
BigDecimal.prototype.bad = function(d, b) {
    throw d + "Not a number: " + b
};
BigDecimal.prototype.badarg = function(b, f, d) {
    throw "Bad argument " + f + " to " + b + ": " + d
};
BigDecimal.prototype.extend = function(b, f) {
    var d;
    if (b.length == f) {
        return b
    }
    d = this.createArrayWithZeros(f);
    this.arraycopy(b, 0, d, 0, b.length);
    return d
};
BigDecimal.prototype.byteaddsub = function(D, g, C, A, v, d) {
    var E;
    var B;
    var u;
    var G;
    var f;
    var k;
    var p;
    var s;
    var o = 0;
    var h = 0;
    var q;
    var w = 0;
    E = D.length;
    B = C.length;
    u = g - 1;
    G = A - 1;
    f = G;
    if (f < u) {
        f = u
    }
    k = null;
    if (d) {
        if ((f + 1) == E) {
            k = D
        }
    }
    if (k == null) {
        k = this.createArrayWithZeros(f + 1)
    }
    p = false;
    if (v == 1) {
        p = true
    } else {
        if (v == ( - 1)) {
            p = true
        }
    }
    s = 0;
    o = f;
    o: for (; o >= 0; o--) {
        if (u >= 0) {
            if (u < E) {
                s = s + D[u]
            }
            u--
        }
        if (G >= 0) {
            if (G < B) {
                if (p) {
                    if (v > 0) {
                        s = s + C[G]
                    } else {
                        s = s - C[G]
                    }
                } else {
                    s = s + (C[G] * v)
                }
            }
            G--
        }
        if (s < 10) {
            if (s >= 0) {
                quick: do {
                    k[o] = s;
                    s = 0;
                    continue o
                } while ( false )
            }
        }
        h = s + 90;
        k[o] = this.bytedig[h];
        s = this.bytecar[h]
    }
    if (s == 0) {
        return k
    }
    q = null;
    if (d) {
        if ((f + 2) == D.length) {
            q = D
        }
    }
    if (q == null) {
        q = new Array(f + 2)
    }
    q[0] = s;
    var y = f + 1;
    w = 0;
    w: for (; y > 0; y--, w++) {
        q[w + 1] = k[w]
    }
    return q
};
BigDecimal.prototype.diginit = function() {
    var b;
    var f = 0;
    var d = 0;
    b = new Array((90 + 99) + 1);
    f = 0;
    f: for (; f <= (90 + 99); f++) {
        d = f - 90;
        if (d >= 0) {
            b[f] = (d % 10);
            BigDecimal.prototype.bytecar[f] = (BigDecimal.div(d, 10));
            continue f
        }
        d = d + 100;
        b[f] = (d % 10);
        BigDecimal.prototype.bytecar[f] = ((BigDecimal.div(d, 10)) - 10)
    }
    return b
};
BigDecimal.prototype.clone = function(d) {
    var b;
    b = new BigDecimal();
    b.ind = d.ind;
    b.exp = d.exp;
    b.form = d.form;
    b.mant = d.mant;
    return b
};
BigDecimal.prototype.checkdigits = function(d, b) {
    if (b == 0) {
        return
    }
    if (this.mant.length > b) {
        if ((! (this.allzero(this.mant, b)))) {
            throw "Too many digits: " + this.toString()
        }
    }
    if (d == null) {
        return
    }
    if (d.mant.length > b) {
        if ((! (this.allzero(d.mant, b)))) {
            throw "Too many digits: " + d.toString()
        }
    }
    return
};
BigDecimal.prototype.round = function() {
    var k;
    var g;
    if (arguments.length == 2) {
        k = arguments[0];
        g = arguments[1]
    } else {
        if (arguments.length == 1) {
            var q = arguments[0];
            k = q.digits;
            g = q.roundingMode
        } else {
            throw "round(): " + arguments.length + " arguments given; expected 1 or 2"
        }
    }
    var s;
    var d;
    var b;
    var o = false;
    var f = 0;
    var p;
    var h = null;
    s = this.mant.length - k;
    if (s <= 0) {
        return this
    }
    this.exp = this.exp + s;
    d = this.ind;
    b = this.mant;
    if (k > 0) {
        this.mant = new Array(k);
        this.arraycopy(b, 0, this.mant, 0, k);
        o = true;
        f = b[k]
    } else {
        this.mant = this.ZERO.mant;
        this.ind = this.iszero;
        o = false;
        if (k == 0) {
            f = b[0]
        } else {
            f = 0
        }
    }
    p = 0;
    modes: do {
        if (g == 4) {
            if (f >= 5) {
                p = d
            }
        } else {
            if (g == 7) {
                if ((! (this.allzero(b, k)))) {
                    throw "round(): Rounding necessary"
                }
            } else {
                if (g == 5) {
                    if (f > 5) {
                        p = d
                    } else {
                        if (f == 5) {
                            if ((! (this.allzero(b, k + 1)))) {
                                p = d
                            }
                        }
                    }
                } else {
                    if (g == 6) {
                        if (f > 5) {
                            p = d
                        } else {
                            if (f == 5) {
                                if ((! (this.allzero(b, k + 1)))) {
                                    p = d
                                } else {
                                    if ((((this.mant[this.mant.length - 1]) % 2)) == 1) {
                                        p = d
                                    }
                                }
                            }
                        }
                    } else {
                        if (g == 1) {} else {
                            if (g == 0) {
                                if ((! (this.allzero(b, k)))) {
                                    p = d
                                }
                            } else {
                                if (g == 2) {
                                    if (d > 0) {
                                        if ((! (this.allzero(b, k)))) {
                                            p = d
                                        }
                                    }
                                } else {
                                    if (g == 3) {
                                        if (d < 0) {
                                            if ((! (this.allzero(b, k)))) {
                                                p = d
                                            }
                                        }
                                    } else {
                                        throw "round(): Bad round value: " + g
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } while ( false );
    if (p != 0) {
        bump: do {
            if (this.ind == this.iszero) {
                this.mant = this.ONE.mant;
                this.ind = p
            } else {
                if (this.ind == this.isneg) {
                    p = -p
                }
                h = this.byteaddsub(this.mant, this.mant.length, this.ONE.mant, 1, p, o);
                if (h.length > this.mant.length) {
                    this.exp++;
                    this.arraycopy(h, 0, this.mant, 0, this.mant.length)
                } else {
                    this.mant = h
                }
            }
        } while ( false )
    }
    if (this.exp > this.MaxExp) {
        throw "round(): Exponent Overflow: " + this.exp
    }
    return this
};
BigDecimal.prototype.allzero = function(g, f) {
    var d = 0;
    if (f < 0) {
        f = 0
    }
    var b = g.length - 1;
    d = f;
    d: for (; d <= b; d++) {
        if (g[d] != 0) {
            return false
        }
    }
    return true
};
BigDecimal.prototype.equalzero = function() {
    return this.allzero(this.mant, 0)
};
BigDecimal.prototype.finish = function(q, h) {
    var p = 0;
    var f = 0;
    var g = null;
    var k = 0;
    var o = 0;
    if (q.digits != 0) {
        if (this.mant.length > q.digits) {
            this.round(q)
        }
    }
    if (h) {
        if (q.form != 0) {
            p = this.mant.length;
            f = p - 1;
            f: for (; f >= 1; f--) {
                if (this.mant[f] != 0) {
                    break f
                }
                p--;
                this.exp++
            }
            if (p < this.mant.length) {
                g = new Array(p);
                this.arraycopy(this.mant, 0, g, 0, p);
                this.mant = g
            }
        }
    }
    this.form = 0;
    var b = this.mant.length;
    f = 0;
    f: for (; b > 0; b--, f++) {
        if (this.mant[f] != 0) {
            if (f > 0) {
                delead: do {
                    g = new Array(this.mant.length - f);
                    this.arraycopy(this.mant, f, g, 0, this.mant.length - f);
                    this.mant = g
                } while ( false )
            }
            k = this.exp + this.mant.length;
            if (k > 0) {
                if (k > q.digits) {
                    if (q.digits != 0) {
                        this.form = q.form
                    }
                }
                if ((k - 1) <= this.MaxExp) {
                    return this
                }
            } else {
                if (k < ( - 5)) {
                    this.form = q.form
                }
            }
            k--;
            if ((k < this.MinExp) || (k > this.MaxExp)) {
                overflow: do {
                    if (this.form == 2) {
                        o = k % 3;
                        if (o < 0) {
                            o = 3 + o
                        }
                        k = k - o;
                        if (k >= this.MinExp) {
                            if (k <= this.MaxExp) {
                                break overflow
                            }
                        }
                    }
                    throw "finish(): Exponent Overflow: " + k
                } while ( false )
            }
            return this
        }
    }
    this.ind = this.iszero;
    if (q.form != 0) {
        this.exp = 0
    } else {
        if (this.exp > 0) {
            this.exp = 0
        } else {
            if (this.exp < this.MinExp) {
                throw "finish(): Exponent Overflow: " + this.exp
            }
        }
    }
    this.mant = this.ZERO.mant;
    return this
};
BigDecimal.prototype.ispos = 1;
BigDecimal.prototype.iszero = 0;
BigDecimal.prototype.isneg = -1;
BigDecimal.prototype.MinExp = -999999999;
BigDecimal.prototype.MaxExp = 999999999;
BigDecimal.prototype.MinArg = -999999999;
BigDecimal.prototype.MaxArg = 999999999;
BigDecimal.prototype.gPlainMC = null;
BigDecimal.prototype.plainMC = function() {
    if (BigDecimal.prototype.gPlainMC == null) {
        BigDecimal.prototype.gPlainMC = new MathContext(0, 0)
    }
    return BigDecimal.prototype.gPlainMC
};
BigDecimal.prototype.bytecar = new Array((90 + 99) + 1);
BigDecimal.prototype.bytedig = BigDecimal.prototype.diginit();
BigDecimal.prototype.ZERO = new BigDecimal("0");
BigDecimal.prototype.ONE = new BigDecimal("1");
BigDecimal.prototype.TEN = new BigDecimal("10");
function BigDecimal() {
    this.ind = 0;
    this.form = 0;
    this.mant = null;
    this.exp = 0;
    if (arguments.length == 0) {
        return
    }
    var D;
    var u;
    var q;
    if (arguments.length == 1) {
        D = arguments[0];
        u = 0;
        q = D.length
    } else {
        D = arguments[0];
        u = arguments[1];
        q = arguments[2]
    }
    if (typeof D == "string") {
        D = D.split("")
    }
    var w;
    var C;
    var G;
    var K;
    var v;
    var B = 0;
    var J = 0;
    var b = false;
    var y = 0;
    var E = 0;
    var A = 0;
    var I = 0;
    var H = 0;
    var g = 0;
    if (q <= 0) {
        this.bad("BigDecimal(): ", D)
    }
    this.ind = this.ispos;
    if (D[0] == ("-")) {
        q--;
        if (q == 0) {
            this.bad("BigDecimal(): ", D)
        }
        this.ind = this.isneg;
        u++
    } else {
        if (D[0] == ("+")) {
            q--;
            if (q == 0) {
                this.bad("BigDecimal(): ", D)
            }
            u++
        }
    }
    w = false;
    C = false;
    G = 0;
    K = -1;
    v = -1;
    var s = q;
    B = u;
    B: for (; s > 0; s--, B++) {
        J = D[B];
        if (J >= "0") {
            if (J <= "9") {
                v = B;
                G++;
                continue B
            }
        }
        if (J == ".") {
            if (K >= 0) {
                this.bad("BigDecimal(): ", D)
            }
            K = B - u;
            continue B
        }
        if (J != "e") {
            if (J != "E") {
                if (J < "0" || J > "9") {
                    this.bad("BigDecimal(): ", D)
                }
                w = true;
                v = B;
                G++;
                continue B
            }
        }
        if ((B - u) > (q - 2)) {
            this.bad("BigDecimal(): ", D)
        }
        b = false;
        if ((D[B + 1]) == ("-")) {
            b = true;
            y = B + 2
        } else {
            if ((D[B + 1]) == ("+")) {
                y = B + 2
            } else {
                y = B + 1
            }
        }
        E = q - ((y - u));
        if ((E == 0) || (E > 9)) {
            this.bad("BigDecimal(): ", D)
        }
        var p = E;
        A = y;
        A: for (; p > 0; p--, A++) {
            I = D[A];
            if (I < "0") {
                this.bad("BigDecimal(): ", D)
            }
            if (I > "9") {
                this.bad("BigDecimal(): ", D)
            } else {
                H = I - "0"
            }
            this.exp = (this.exp * 10) + H
        }
        if (b) {
            this.exp = -this.exp
        }
        C = true;
        break B
    }
    if (G == 0) {
        this.bad("BigDecimal(): ", D)
    }
    if (K >= 0) {
        this.exp = (this.exp + K) - G
    }
    var o = v - 1;
    B = u;
    B: for (; B <= o; B++) {
        J = D[B];
        if (J == "0") {
            u++;
            K--;
            G--
        } else {
            if (J == ".") {
                u++;
                K--
            } else {
                if (J <= "9") {
                    break B
                } else {
                    break B
                }
            }
        }
    }
    this.mant = new Array(G);
    A = u;
    if (w) {
        exotica: do {
            var h = G;
            B = 0;
            B: for (; h > 0; h--, B++) {
                if (B == K) {
                    A++
                }
                I = D[A];
                if (I <= "9") {
                    this.mant[B] = I - "0"
                } else {
                    this.bad("BigDecimal(): ", D)
                }
                A++
            }
        } while ( false )
    } else {
        simple: do {
            var f = G;
            B = 0;
            B: for (; f > 0; f--, B++) {
                if (B == K) {
                    A++
                }
                this.mant[B] = D[A] - "0";
                A++
            }
        } while ( false )
    }
    if (this.mant[0] == 0) {
        this.ind = this.iszero;
        if (this.exp > 0) {
            this.exp = 0
        }
        if (C) {
            this.mant = this.ZERO.mant;
            this.exp = 0
        }
    } else {
        if (C) {
            this.form = 1;
            g = (this.exp + this.mant.length) - 1;
            if ((g < this.MinExp) || (g > this.MaxExp)) {
                this.bad("BigDecimal(): ", D)
            }
        }
    }
    return
}
DecimalType.prototype = new Datatype();
DecimalType.prototype.constructor = DecimalType;
DecimalType.superclass = Datatype.prototype;
DatatypeFactories[10] = function(d, b) {
    if (typeof b != "undefined" && "p" in b) {
        return new DecimalType(d, b.p)
    } else {
        return new DecimalType(d)
    }
};
function DecimalType(b, d) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b, d)
    }
}
DecimalType.prototype.mPrecision = 2;
DecimalType.prototype.init = function(g, f) {
    DecimalType.superclass.init.call(this);
    if (typeof f == "number") {
        this.mPrecision = f
    }
    if (g instanceof Datatype) {
        this.mValue = g.toDecimal()
    } else {
        if (typeof g == "string") {
            try {
                var b = new RegExp("^\\s*([+-]?[\\d,]+(\\.\\d+)?)(.*)$");
                g = g.replace(b, "$1");
                this.mValue = new BigDecimal(g)
            } catch(d) {
                this.mValue = new BigDecimal("0")
            }
        } else {
            if (g == null) {
                this.mValue = new BigDecimal("0")
            } else {
                if (g instanceof BigDecimal) {
                    this.mValue = g
                } else {}
            }
        }
    }
};
DecimalType.prototype.set = function(b) {
    this.mValue = b
};
DecimalType.prototype.type = 10;
DecimalType.prototype.isNull = false;
DecimalType.prototype.args = function() {
    return {
        p: this.mPrecision
    }
};
DecimalType.prototype.toDecimal = function() {
    return this.mValue
};
DecimalType.prototype.toString = function() {
    var b = DecimalType.Round(this.mValue, this.mPrecision);
    return En_USDecimalToLC(b.toString())
};
DecimalType.prototype.compareValStr = function() {
    return this.toString()
};
DecimalType.prototype.toChar = function() {
    return this.toString()
};
DecimalType.prototype.toPrimitive = function() {
    var b = DecimalType.Round(this.mValue, this.mPrecision);
    return b.toString()
};
DecimalType.Round = function(d, b) {
    return new BigDecimal(d.format( - 1, b))
};
DecimalType.prototype.ROUND = function() {
    return new DecimalType(DecimalType.Round(this.mValue, 0), this.mPrecision)
};
DecimalType.prototype.TRUNC = function() {
    return new DecimalType(DecimalType.Round(this.mValue.add(new BigDecimal("-0.5")), 0), this.mPrecision)
};
DecimalType.prototype.ADD = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    this.set(f.toDecimal().add(d.toDecimal()));
    return this
};
DecimalType.prototype.SUB = function(f, d) {
    if ((! (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || (1 << 0 & (1 << f.type))) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) || (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type)) && (f.type != d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    this.set(f.toDecimal().subtract(d.toDecimal()));
    return this
};
DecimalType.prototype.MUL = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    this.mPrecision = 9;
    this.set(f.toDecimal().multiply(d.toDecimal()));
    return this
};
DecimalType.prototype.DIV = function(f, d) {
    this.mPrecision = 9;
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (d.toDecimal() == 0) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9306)
    }
    f = f.toDecimal();
    d = d.toDecimal();
    this.set(f.divide(d, 9, 4));
    return this
};
DecimalType.prototype.MOD = function(f, d) {
    if (! ((1 << 2 & (1 << f.type)) && (1 << 2 & (1 << d.type))) && !((1 << 0 & (1 << f.type)) && (((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type))) | (1 << 6 & (1 << d.type))) || ((1 << 4 | 1 << 5) & (1 << d.type)))) && !((((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) | (1 << 6 & (1 << f.type))) || ((1 << 4 | 1 << 5) & (1 << f.type))) && (1 << 0 & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (! (f instanceof IntegerType && (d instanceof IntegerType || d instanceof NullType))) {
        this.set(new BigDecimal("0"))
    } else {
        if (d.toInteger() == 0) {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9306)
        }
        this.set(new BigDecimal("" + (f.toInteger() % d.toInteger())))
    }
    return this
};
DecimalType.prototype.NEG = function(b) {
    this.set(b.toDecimal().multiply(new BigDecimal("-1")));
    return this
};
DecimalType.prototype.EQ = function(b) {
    if (b.isNull) {
        return false
    }
    return (this.mValue.compareTo(b.toDecimal()) == 0)
};
DecimalType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
DecimalType.prototype.GT = function(b) {
    if (b.isNull) {
        return false
    }
    return (this.mValue.compareTo(b.toDecimal()) > 0)
};
DecimalType.prototype.GE = function(b) {
    if (b.isNull) {
        return false
    }
    return (this.mValue.compareTo(b.toDecimal()) >= 0)
};
DecimalType.prototype.LT = function(b) {
    return ! this.GE(b)
};
DecimalType.prototype.LE = function(b) {
    return ! this.GT(b)
};
DecimalType.prototype.toReal = function() {
    return new RealType(this.mValue.toString()).toReal()
};
DecimalType.prototype.toInteger = function() {
    return new IntegerType(this.mValue.toString()).toInteger()
};
CurrencyType.prototype = new Datatype();
CurrencyType.prototype.constructor = CurrencyType;
CurrencyType.superclass = Datatype.prototype;
DatatypeFactories[12] = function(d, b) {
    if (typeof b != "undefined" && "p" in b) {
        return new CurrencyType(d, b.p)
    } else {
        return new CurrencyType(d)
    }
};
function CurrencyType(b, d, f) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b, d, f)
    }
}
CurrencyType.prototype.type = 12;
CurrencyType.prototype.isNull = false;
CurrencyType.prototype.mPrecision = 2;
CurrencyType.RE_NUMBER = new RegExp("^\\s*([+-]?[\\d,]+(\\.\\d+)?)(.*)$");
CurrencyType.prototype.init = function(f, d, o) {
    CurrencyType.superclass.init.call(this);
    if (typeof d == "number") {
        this.mPrecision = d
    }
    if (typeof o != "boolean") {
        o = false
    }
    if (f instanceof CurrencyType) {
        this.mValue = f.mValue;
        if (this.mValue == null) {
            this.mValue = new BigDecimal("0")
        }
        this.mCurCode = f.mCurCode;
        if (typeof(d) == "object") {
            this.mPrecision = d.GetPrecision(this.mCurCode)
        } else {
            this.mPrecision = f.mPrecision
        }
        this.mDate = f.mDate;
        this.mFunc = {};
        for (var k in f.mFunc) {
            this.mFunc[k] = {};
            for (var q in f.mFunc[k]) {
                this.mFunc[k][q] = f.mFunc[k][q]
            }
        }
    } else {
        if (f instanceof Datatype) {
            f = f.toCurrency(d);
            this.mValue = f.mValue;
            this.mCurCode = f.mCurCode;
            this.mPrecision = f.mPrecision;
            this.mDate = f.mDate;
            this.mFunc = {};
            for (var k in f.mFunc) {
                this.mFunc[k] = {
                    p: f.mFunc[k].p,
                    v: f.mFunc[k].v
                }
            }
        } else {
            if (typeof f == "string") {
                this.mValue = null;
                this.mCurCode = "";
                var s = f.split(" ");
                if (s.length > 1) {
                    this.mCurCode = s[1].toUpperCase();
                    if (typeof(d) == "object") {
                        this.mPrecision = d.GetPrecision(this.mCurCode)
                    }
                }
                if (s.length > 0) {
                    try {
                        var v = s[0];
                        if (o) {
                            v = LCDecimalToEn_US(v, false)
                        }
                        v = v.replace(CurrencyType.RE_NUMBER, "$1");
                        this.mValue = new BigDecimal(v)
                    } catch(g) {
                        if (this.mCurCode == null || this.mCurCode == "") {
                            this.mValue = null
                        } else {
                            this.mValue = new BigDecimal("0")
                        }
                    }
                }
                if (s.length > 2) {
                    this.mDate = new TimeType(s[2]).toInteger()
                }
                this.mFunc = {};
                var h, b, u;
                for (h = 3; h + 1 < s.length && s[h + 1].length > 0; h += 2) {
                    b = 2;
                    if (typeof d == "object") {
                        b = d.GetPrecision(s[h + 1])
                    }
                    u = s[h];
                    if (o) {
                        u = LCDecimalToEn_US(u, false)
                    }
                    try {
                        u = new BigDecimal(u)
                    } catch(g) {
                        u = new BigDecimal("0")
                    }
                    this.mFunc[s[h + 1]] = {
                        v: u,
                        p: b
                    }
                }
            } else {
                if (f == null) {
                    this.mValue = null;
                    this.mCurCode = "";
                    this.mFunc = null
                } else {
                    if (f instanceof BigDecimal || typeof f == "number") {
                        if (typeof f == "number") {
                            f = new BigDecimal("" + f)
                        }
                        this.mValue = f;
                        this.mCurCode = "";
                        this.mFunc = null
                    } else {}
                }
            }
        }
    }
    this.mDate = this.getDate()
};
CurrencyType.prototype.part = function(d, b) {
    switch (b) {
    case 0:
        return this;
    case 1:
        return (this.mValue == null) ? Null: new DecimalType(this.mValue);
    case 2:
        return new CharType(this.mCurCode);
    case 3:
        return new TimeType(this.getDate());
    case 4:
        if (d in this.mFunc) {
            var f = this.mFunc[d].v;
            if (f == null) {
                return Null
            }
            f = new CurrencyType(f, this.mFunc[d].p);
            f.mCurCode = d;
            return f
        } else {
            return Null
        }
    }
    return Null
};
CurrencyType.prototype.compound = function(d) {
    if (d.length != 1 && d.length != 2) {
        return null
    }
    var f = "";
    var b = -1;
    var g = d[0].toUpperCase();
    if (g == "FIELD") {
        b = 0
    } else {
        if (g == "VALUE") {
            b = 1
        } else {
            if (g == "TYPE") {
                b = 2
            } else {
                if (g == "DATE") {
                    b = 3
                } else {
                    if (typeof g == "string" && g.length == 3) {
                        b = 4;
                        f = g
                    } else {
                        if (g.isDigits()) {
                            b = parseInt(g, 10);
                            if (b < 0 || b > 4) {
                                return null
                            }
                        } else {
                            return null
                        }
                    }
                }
            }
        }
    }
    return this.part(f, b)
};
CurrencyType.prototype.toCurrency = function() {
    return this
};
CurrencyType.prototype.toString = function() {
    if (this.mValue == null) {
        return this.mCurCode
    }
    var b = DecimalType.Round(this.mValue, this.mPrecision);
    return En_USDecimalToLC(b.toString()) + " " + this.mCurCode
};
CurrencyType.prototype.compareValStr = function() {
    return this.toString()
};
CurrencyType.prototype.toChar = function() {
    return this.toString()
};
CurrencyType.prototype.toPrimitive = function() {
    var g = "";
    if (this.mValue != null) {
        g = DecimalType.Round(this.mValue, this.mPrecision)
    }
    if (this.mCurCode == null) {
        return g.toString()
    }
    g += " " + this.mCurCode;
    var b = true;
    for (var d in this.mFunc) {
        if ("v" in this.mFunc[d] && this.mFunc[d].v != null) {
            if (b) {
                g += " " + this.getDate();
                b = false
            }
            g += " " + DecimalType.Round(this.mFunc[d].v, this.mFunc[d].p);
            g += " " + d
        }
    }
    return g.toString()
};
CurrencyType.prototype.toDecimal = function() {
    if (this.mValue == null) {
        return new BigDecimal("0")
    }
    return this.mValue
};
CurrencyType.prototype.toInteger = function() {
    if (this.mValue == null) {
        return new IntegerType(0)
    }
    return new IntegerType(this.mValue.toString()).toInteger()
};
CurrencyType.prototype.toReal = function() {
    if (this.mValue == null) {
        return new RealType("0")
    }
    return new RealType(this.mValue.toString()).toReal()
};
CurrencyType.prototype.CalculateFunctional = function() {
    var f;
    if (this.mValue == null) {
        return
    }
    if (this.mValue.equalzero()) {
        for (f in this.mFunc) {
            this.mFunc[f].v = new BigDecimal("0")
        }
        return
    }
    var b = null;
    for (f in this.mFunc) {
        var d = this.mCurCode + f;
        if (this.mCurCode == f) {
            this.mFunc[f].v = new BigDecimal(this.mValue.toString())
        } else {
            if (b == null) {
                b = GetExchangeRates(ARKWGetByName(getCurrentWindowID_NS(), "SERVER").toString(), this.getDate())
            }
            if (d in b && b[d]) {
                this.mFunc[f].v = this.mValue.multiply(b[d])
            }
        }
    }
};
CurrencyType.prototype.CurrSetDate = function(b) {
    if (b > 2147483647 || b <= 0) {
        b = new Date().UnixTimestamp()
    }
    var d = new CurrencyType(this.mValue, this.mPrecision);
    d.mCurCode = this.mCurCode;
    d.mFunc = {};
    d.mDate = b;
    var f;
    for (f in this.mFunc) {
        d.mFunc[f] = {
            p: this.mFunc[f].p,
            v: null
        }
    }
    d.CalculateFunctional();
    return d
};
CurrencyType.prototype.CurrSetType = function(f) {
    if (f instanceof CurrencyType) {
        f = f.mCurCode
    } else {
        f = f.toString();
        var d = /[A-Za-z]+/;
        var b = d.exec(f);
        if (b) {
            f = b[0].toUpperCase()
        } else {
            return Null
        }
    }
    if (! (f in currencyCodes)) {
        return Null
    }
    var g = new CurrencyType(this.mValue, this.mPrecision);
    g.mCurCode = f;
    g.mFunc = {};
    g.mDate = this.getDate();
    g.mValue = this.mValue;
    var h;
    for (h in this.mFunc) {
        g.mFunc[h] = {
            p: this.mFunc[h].p,
            v: null
        }
    }
    g.CalculateFunctional();
    return g
};
CurrencyType.prototype.CurrSetValue = function(b) {
    var d = new CurrencyType(this.mValue, this.mPrecision);
    d.mCurCode = this.mCurCode;
    d.mFunc = {};
    d.mDate = this.getDate();
    d.mValue = new BigDecimal(b.toString());
    var f;
    for (f in this.mFunc) {
        d.mFunc[f] = {
            p: this.mFunc[f].p,
            v: null
        }
    }
    d.CalculateFunctional();
    return d
};
CurrencyType.prototype.CurrConvert = function(h, f, b) {
    if (typeof b != "number") {
        b = this.mPrecision
    }
    if (f > 2147483647 || f <= 0) {
        f = new Date().UnixTimestamp()
    }
    h = h.toUpperCase();
    if (! (h in currencyCodes)) {
        return Null
    }
    var k = new CurrencyType(this.mValue, b);
    k.mCurCode = h;
    k.mFunc = {};
    k.mDate = f;
    if (this.mCurCode == k.mCurCode) {
        k.mValue = this.mValue
    } else {
        var d = GetExchangeRates(ARKWGetByName(getCurrentWindowID_NS(), "SERVER").toString(), f);
        var g = this.mCurCode + h;
        if (g in d && d[g]) {
            k.mValue = ((this.mValue == null) ? null: this.mValue.multiply(d[g]))
        } else {
            return Null
        }
    }
    var o;
    for (o in this.mFunc) {
        k.mFunc[o] = {
            p: this.mFunc[o].p,
            v: null
        }
    }
    k.CalculateFunctional();
    return k
};
CurrencyType.prototype.getDate = function() {
    if (this.mDate == null || typeof(this.mDate) == "undefined") {
        this.mDate = new Date().UnixTimestamp()
    }
    return this.mDate
};
CurrencyType.prototype.ADD = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    return CurrencyType.ArithOp(f, d, BigDecimal.prototype.add, this)
};
CurrencyType.prototype.SUB = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    return CurrencyType.ArithOp(f, d, BigDecimal.prototype.subtract, this)
};
CurrencyType.prototype.MUL = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    this.mPrecision = 9;
    return CurrencyType.ArithOp(f, d, BigDecimal.prototype.multiply, this)
};
CurrencyType.prototype.DIV = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    this.mPrecision = 9;
    return CurrencyType.ArithOp(f, d, BigDecimal.prototype.divide, this)
};
CurrencyType.prototype.MOD = function(f, d) {
    if (! ((1 << 2 & (1 << f.type)) && (1 << 2 & (1 << d.type))) && !((1 << 0 & (1 << f.type)) && (((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type))) | (1 << 6 & (1 << d.type))) || ((1 << 4 | 1 << 5) & (1 << d.type)))) && !((((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) | (1 << 6 & (1 << f.type))) || ((1 << 4 | 1 << 5) & (1 << f.type))) && (1 << 0 & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (! (f instanceof IntegerType && (d instanceof IntegerType || d instanceof NullType))) {
        this.mValue = new BigDecimal("0")
    } else {
        if (d.toInteger() == 0) {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9306)
        }
        this.mValue = new BigDecimal("" + (f.toInteger() % d.toInteger()))
    }
    return this
};
CurrencyType.ArithOp = function(h, f, o, d) {
    var g = (o == BigDecimal.prototype.divide);
    var k = (h instanceof CurrencyType) && !(f instanceof CurrencyType);
    h = h.toCurrency(d.mPrecision);
    f = f.toCurrency(d.mPrecision);
    if (h.mValue == null && f.mValue == null) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (h.mValue == null || f.mValue == null) {
        return Null
    }
    if (h instanceof CurrencyType && h.mCurCode != "") {
        if (f.mCurCode == "") {
            f.mCurCode = h.mCurCode
        }
        if (f.mCurCode != h.mCurCode) {
            if (h.mCurCode in f.mFunc || !(f.mCurCode in h.mFunc)) {
                f = f.CurrConvert(h.mCurCode, f.getDate(), d.mPrecision)
            } else {
                h = h.CurrConvert(f.mCurCode, h.getDate(), d.mPrecision)
            }
            if (f.isNull) {
                f = new CurrencyType("0");
                f.mCurCode = h.mCurCode
            }
        }
    } else {
        h = new CurrencyType(h.toDecimal());
        h.mCurCode = f.mCurCode
    }
    d.mCurCode = h.mCurCode;
    if (g && f.toDecimal() == 0) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9306)
    }
    d.mValue = o.call(h.mValue, f.mValue);
    d.mDate = h.mDate;
    d = d.ROUNDToOwnPrecision();
    if (d.mCurCode && (!g || (g && k))) {
        return d
    } else {
        return new DecimalType(d.mValue)
    }
};
CurrencyType.prototype.NEG = function(b) {
    if (b instanceof CurrencyType) {
        this.mValue = b.mValue.multiply(new BigDecimal("-1"));
        this.mCurCode = b.mCurCode;
        this.mPrecision = b.mPrecision;
        return this
    } else {
        return new DecimalType(b.toDecimal().multiply(new BigDecimal("-1")))
    }
};
CurrencyType.prototype.RELOP = function(f, g) {
    if (f.isNull) {
        return false
    }
    if (this.mValue == null) {
        this.mValue = new BigDecimal("0")
    }
    if (f.isNull) {
        return false
    }
    if (f instanceof CurrencyType) {
        if (this.mCurCode == f.mCurCode) {
            return g(this.mValue.compareTo(f.mValue))
        } else {
            if (f.mCurCode) {
                var d = this.CurrConvert(f.mCurCode, this.getDate());
                return (!d.isNull && d.mCurCode == f.mCurCode && g(d.mValue.compareTo(f.mValue)))
            }
        }
    } else {
        return g(this.mValue.compareTo(f.toDecimal()))
    }
    return false
};
CurrencyType.prototype.EQ = function(b) {
    return this.RELOP(b,
    function(d) {
        return (d == 0)
    })
};
CurrencyType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
CurrencyType.prototype.GT = function(b) {
    return this.RELOP(b,
    function(d) {
        return (d > 0)
    })
};
CurrencyType.prototype.GE = function(b) {
    return this.RELOP(b,
    function(d) {
        return (d >= 0)
    })
};
CurrencyType.prototype.LT = function(b) {
    return ! this.GE(b)
};
CurrencyType.prototype.LE = function(b) {
    return ! this.GT(b)
};
CurrencyType.prototype.ROUNDToOwnPrecision = function() {
    var b = new CurrencyType(this);
    return this.CurrSetValue(DecimalType.Round(b.mValue, b.mPrecision))
};
CurrencyType.prototype.ROUND = function() {
    var b = new CurrencyType(this);
    return this.CurrSetValue(DecimalType.Round(b.mValue, 0))
};
CurrencyType.prototype.TRUNC = function() {
    var b = new CurrencyType(this);
    return this.CurrSetValue(new DecimalType(b.mValue, b.mPrecision).TRUNC().toDecimal())
};
CurrencyType.prototype.EQForSet = function(b) {
    if (b.type == 12 && this.mDate != b.mDate) {
        return false
    }
    return this.toString() == b.toString()
};
CurrencyType.prototype.Diff = function(b) {
    return ! (this.type == 12 && this.mValue == b.mValue && this.mDate == b.mDate)
};
RealType.prototype = new Datatype();
RealType.prototype.constructor = RealType;
RealType.superclass = Datatype.prototype;
DatatypeFactories[3] = function(d, b) {
    if (typeof b != "undefined" && "p" in b) {
        return new RealType(d, b.p)
    } else {
        return new RealType(d)
    }
};
function RealType(b, d) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b, d)
    }
}
RealType.prototype.mPrecision = 6;
RealType.prototype.init = function(d, b) {
    if (typeof b == "number") {
        this.mPrecision = b
    }
    if (d instanceof Datatype) {
        this.mValue = d.toReal()
    } else {
        if (typeof d == "string") {
            this.mValue = parseFloat(d);
            if (isNaN(this.mValue)) {
                this.mValue = 0
            }
        } else {
            this.mValue = d
        }
    }
};
RealType.prototype.set = function(b) {
    this.mValue = b
};
RealType.prototype.type = 3;
RealType.prototype.isNull = false;
RealType.prototype.toReal = function() {
    return this.mValue
};
RealType.prototype.toChar = function() {
    return En_USRealToLC(this.mValue.toFixed(this.mPrecision))
};
RealType.prototype.args = function() {
    return {
        p: this.mPrecision
    }
};
RealType.prototype.toString = function() {
    var b = "";
    if (this.mValue >= 1000000000 || this.mValue <= -1000000000 || (this.mValue > 0 && this.mValue < 0.000001) || (this.mValue < 0 && this.mValue > -0.000001)) {
        if (this.mValue < 0) {
            var o = -(this.mValue);
            b = "-" + o.toExponential(this.mPrecision)
        } else {
            b = this.mValue.toExponential(this.mPrecision)
        }
        var h = new RegExp("^([+-]?\\d+)(\\.[1-9]*)0*([Ee][+-]?\\d+)$");
        b = b.replace(h, "$1$2$3");
        h = new RegExp("^(.*)\\.([Ee].*)$");
        b = b.replace(h, "$1$2");
        var d = b.length - 1;
        while (d > 0 && b.charAt(d) != "+" && b.charAt(d) != "-") {
            d--
        }
        d++;
        var g = b.substring(0, d);
        var k = 3 - (b.length - d);
        for (var f = 0; f < k; f++) {
            g += "0"
        }
        g += b.substr(d);
        b = g
    } else {
        b = this.mValue.toFixed(this.mPrecision)
    }
    return En_USRealToLC(b)
};
RealType.prototype.compareValStr = function() {
    return this.toString()
};
RealType.prototype.toPrimitive = function() {
    return this.mValue.toString()
};
RealType.prototype.ADD = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    this.set(f.toReal() + d.toReal());
    return this
};
RealType.prototype.SUB = function(f, d) {
    if ((! (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || (1 << 0 & (1 << f.type))) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) || (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type)) && (f.type != d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    this.set(f.toReal() - d.toReal());
    return this
};
RealType.prototype.MUL = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    this.mPrecision = 9;
    this.set(f.toReal() * d.toReal());
    return this
};
RealType.prototype.DIV = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    this.mPrecision = 9;
    if (d.toReal() == 0) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9306)
    }
    this.set(f.toReal() / d.toReal());
    return this
};
RealType.prototype.MOD = function(f, d) {
    if (! ((1 << 2 & (1 << f.type)) && (1 << 2 & (1 << d.type))) && !((1 << 0 & (1 << f.type)) && (((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type))) | (1 << 6 & (1 << d.type))) || ((1 << 4 | 1 << 5) & (1 << d.type)))) && !((((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) | (1 << 6 & (1 << f.type))) || ((1 << 4 | 1 << 5) & (1 << f.type))) && (1 << 0 & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (! (f instanceof IntegerType && (d instanceof IntegerType || d instanceof NullType))) {
        this.set(0)
    } else {
        if (d.toInteger() == 0) {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9306)
        }
        this.set(f.toInteger() % d.toInteger())
    }
    return this
};
RealType.prototype.NEG = function(b) {
    this.set( - b.toReal());
    return this
};
RealType.prototype.EQ = function(b) {
    if (b.isNull) {
        return false
    }
    return this.mValue == b.toReal()
};
RealType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
RealType.prototype.GT = function(b) {
    if (b.isNull) {
        return false
    }
    return this.mValue > b.toReal()
};
RealType.prototype.GE = function(b) {
    if (b.isNull) {
        return false
    }
    return this.mValue >= b.toReal()
};
RealType.prototype.LT = function(b) {
    return ! this.GE(b)
};
RealType.prototype.LE = function(b) {
    return ! this.GT(b)
};
RealType.prototype.toDecimal = function() {
    var b = new DecimalType(this.mValue.toFixed(this.mPrecision));
    return b.toDecimal()
};
RealType.prototype.toInteger = function() {
    return new IntegerType(this.mValue).toInteger()
};
IntegerType.prototype = new Datatype();
IntegerType.prototype.constructor = IntegerType;
IntegerType.superclass = Datatype.prototype;
DatatypeFactories[2] = function(b) {
    return new IntegerType(b)
};
function IntegerType(b) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b)
    }
}
IntegerType.prototype.init = function(g) {
    if (g instanceof Datatype) {
        this.mValue = g.toInteger()
    } else {
        if (typeof g == "string") {
            var b = /([+-]?[0-9]*).*/;
            g = g.replace(b, "$1");
            var d = parseInt(g, 10);
            if (d > 2147483647) {
                this.mValue = 2147483647
            } else {
                if (d < -2147483647) {
                    this.mValue = -2147483647
                } else {
                    this.mValue = d
                }
            }
            if (isNaN(this.mValue)) {
                this.mValue = 0
            }
        } else {
            if (typeof g == "number") {
                if (g < 0) {
                    this.mValue = Math.ceil(g)
                } else {
                    this.mValue = Math.floor(g)
                }
            } else {
                this.mValue = g
            }
        }
    }
    if (this.mValue < -2147483647) {
        this.mValue = -2147483647
    } else {
        if (this.mValue > 2147483647) {
            this.mValue = 2147483647
        }
    }
};
IntegerType.prototype.set = function(b) {
    if (b < -2147483647) {
        b = -2147483647
    } else {
        if (b > 2147483647) {
            b = 2147483647
        }
    }
    this.mValue = b
};
IntegerType.prototype.type = 2;
IntegerType.prototype.isNull = false;
IntegerType.prototype.toInteger = function() {
    return this.mValue
};
IntegerType.prototype.toReal = function() {
    return this.mValue
};
IntegerType.prototype.toString = function() {
    return this.mValue.toString()
};
IntegerType.prototype.compareValStr = function() {
    return this.toString()
};
IntegerType.prototype.toPrimitive = function() {
    return this.mValue.toString()
};
IntegerType.prototype.ADD = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.ADD(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
            var g = new DecimalType(null);
            this.set(g.ADD(f, d).toInteger())
        } else {
            this.set(f.toInteger() + d.toInteger())
        }
    }
    return this
};
IntegerType.prototype.SUB = function(f, d) {
    if ((! (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || (1 << 0 & (1 << f.type))) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) || (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type)) && (f.type != d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.SUB(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
            var g = new DecimalType(null);
            this.set(g.SUB(f, d).toInteger())
        } else {
            this.set(f.toInteger() - d.toInteger())
        }
    }
    return this
};
IntegerType.prototype.MUL = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.MUL(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType) {
            var g = new DecimalType(null);
            this.set(g.MUL(f, d).toInteger())
        } else {
            if (f instanceof CurrencyType || d instanceof CurrencyType) {
                var g = new CurrencyType(null);
                this.set(g.MUL(f, d).toInteger())
            } else {
                this.set(f.toInteger() * d.toInteger())
            }
        }
    }
    return this
};
IntegerType.prototype.DIV = function(f, d) {
    if (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (d.toInteger() == 0) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9306);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.DIV(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType) {
            var g = new DecimalType(null);
            this.set(g.DIV(f, d).toInteger())
        } else {
            if (f instanceof CurrencyType || d instanceof CurrencyType) {
                var g = new CurrencyType(null);
                this.set(g.DIV(f, d).toInteger())
            } else {
                var g = (f.toInteger() / d.toInteger());
                if (g < 0) {
                    this.set(Math.ceil(g))
                } else {
                    this.set(Math.floor(g))
                }
            }
        }
    }
    return this
};
IntegerType.prototype.MOD = function(f, d) {
    if (! (((((1 << 4 | 1 << 5) & (1 << f.type)) | (1 << 0 & (1 << f.type))) | (1 << 6 & (1 << f.type))) && (((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type))) | (1 << 6 & (1 << d.type))) | ((1 << 4 | 1 << 5) & (1 << d.type)))) && !((1 << 2 & (1 << f.type)) && (((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type))) | (1 << 6 & (1 << d.type))) | ((1 << 4 | 1 << 5) & (1 << d.type))))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) && !(1 << 2 & (1 << d.type))) {
        this.set(0)
    } else {
        if (d.toInteger() == 0) {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9306)
        }
        this.set(f.toInteger() % d.toInteger())
    }
    return this
};
IntegerType.prototype.NEG = function(b) {
    this.set( - b.toInteger());
    return this
};
IntegerType.prototype.EQ = function(b) {
    if (b.isNull) {
        return false
    }
    return this.mValue == b.toInteger()
};
IntegerType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
IntegerType.prototype.GT = function(b) {
    if (b.isNull) {
        return false
    }
    return this.mValue > b.toInteger()
};
IntegerType.prototype.GE = function(b) {
    if (b.isNull) {
        return false
    }
    return this.mValue >= b.toInteger()
};
IntegerType.prototype.LT = function(b) {
    return ! this.GE(b)
};
IntegerType.prototype.LE = function(b) {
    return ! this.GT(b)
};
IntegerType.ZERO = new IntegerType(0);
IntegerType.ONE = new IntegerType(1);
TimeType.prototype = new Datatype();
TimeType.prototype.constructor = TimeType;
TimeType.superclass = Datatype.prototype;
DatatypeFactories[7] = function(b) {
    return new TimeType(b)
};
function TimeType(b) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b)
    }
}
TimeType.prototype.init = function(b) {
    if (b instanceof Datatype) {
        this.mValue = b.toTime().toInteger()
    } else {
        if (typeof b == "string") {
            if (b.isNumeric()) {
                this.mValue = parseInt(b, 10)
            } else {
                this.mValue = TimeType.getTimestamp(b)
            }
        } else {
            this.mValue = b
        }
    }
    this.set(this.mValue)
};
TimeType.prototype.set = function(b) {
    if (b < 0) {
        b = 0;
        this.valueAdjusted = true
    } else {
        if (b > 2147483647) {
            b = 2147483647;
            this.valueAdjusted = true
        }
    }
    this.mValue = b
};
TimeType.prototype.type = 7;
TimeType.prototype.isNull = false;
TimeType.prototype.valueAdjusted = false;
TimeType.prototype.toInteger = function() {
    return this.mValue
};
TimeType.prototype.toDecimal = function() {
    return new IntegerType(this.toInteger()).toDecimal()
};
TimeType.prototype.toReal = function() {
    return this.mValue
};
TimeType.prototype.DisplayFormat = 0;
TimeType.prototype.setDisplayFormat = function(b) {
    this.DisplayFormat = b
};
TimeType.prototype.getDisplayFormat = function() {
    return this.DisplayFormat
};
TimeType.prototype.toString = function(b) {
    if (arguments.length < 1) {
        b = this.DisplayFormat
    }
    return TimeType.getDateTimeString(this.mValue, b)
};
TimeType.prototype.compareValStr = function() {
    return this.toString()
};
TimeType.prototype.toPrimitive = function() {
    return this.mValue.toString()
};
TimeType.prototype.toTOD = function() {
    var b = new ARDate();
    b.STimestamp(this.mValue);
    return new TODType(b.format(localeInfo.timeFormatPattern, 7))
};
TimeType.prototype.toDate = function() {
    var b = new ARDate();
    b.STimestamp(this.mValue);
    return new DateType(b.format(localeInfo.dateFormatPattern, 13))
};
TimeType.prototype.ADD = function(f, d) {
    if (((((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) | (1 << 13 & (1 << f.type)) | (1 << 14 & (1 << f.type))) && d instanceof CharType) || ((((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type)) | (1 << 13 & (1 << d.type)) | (1 << 14 & (1 << d.type))) && f instanceof CharType)) {
        return new CharType(f.toString() + d.toString())
    }
    if (f instanceof CurrencyType || (!(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) && (!(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type))) || (1 << 12 & (1 << d.type))))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (((1 << 4 | 1 << 5) & (1 << f.type))) {
        f = f.toTime()
    }
    if (((1 << 4 | 1 << 5) & (1 << d.type))) {
        d = d.toTime()
    }
    if (f instanceof DateKWType || d instanceof DateKWType || f instanceof TODKWType || d instanceof TODKWType) {
        this.set(f.toInteger() + d.toInteger())
    } else {
        if (f instanceof DateType || d instanceof DateType) {
            var g = new DateType(f.toInteger() + d.toInteger());
            this.set(g.toTime().toInteger())
        } else {
            if (f instanceof TODType || d instanceof TODType) {
                var g = new TODType(f.toInteger() + d.toInteger());
                this.set(g.toTime().toInteger())
            } else {
                if (f instanceof RealType || d instanceof RealType) {
                    var g = new RealType(0);
                    this.set(g.ADD(f, d).toInteger())
                } else {
                    if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
                        var g = new DecimalType(null);
                        this.set(g.ADD(f, d).toInteger())
                    } else {
                        this.set(f.toInteger() + d.toInteger())
                    }
                }
            }
        }
    }
    return this
};
TimeType.prototype.SUB = function(f, d) {
    if (((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) || (1 << 13 & (1 << f.type)) || (1 << 14 & (1 << f.type))) && !(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))) || (!(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) && (1 << 12 & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (((1 << 4 | 1 << 5) & (1 << f.type))) {
        f = f.toTime()
    }
    if (((1 << 4 | 1 << 5) & (1 << d.type))) {
        d = d.toTime()
    }
    if (f instanceof DateKWType || d instanceof DateKWType || f instanceof TODKWType || d instanceof TODKWType) {
        this.set(f.toInteger() - d.toInteger())
    } else {
        if (f instanceof DateType) {
            var g = new DateType(f.toInteger() - d.toInteger());
            this.set(g.toTime().toInteger())
        } else {
            if (f instanceof TODType) {
                var g = new TODType(f.toInteger() - d.toInteger());
                this.set(g.toTime().toInteger())
            } else {
                if (f instanceof RealType || (!(f instanceof TimeType) && (d instanceof RealType))) {
                    var g = new RealType(0);
                    this.set(g.SUB(f, d).toInteger())
                } else {
                    if ((f instanceof DecimalType || (!(f instanceof TimeType) && (d instanceof DecimalType))) || (f instanceof CurrencyType || (!(f instanceof TimeType) && (d instanceof CurrencyType)))) {
                        var g = new DecimalType(null);
                        this.set(g.SUB(f, d).toInteger())
                    } else {
                        if (f instanceof CharType) {
                            f = f.toTime()
                        }
                        this.set(f.toInteger() - d.toInteger())
                    }
                }
            }
        }
    }
    return this
};
TimeType.prototype.MOD = function(f, d) {
    if (! (((1 << 2 & (1 << f.type)) || (1 << 0 & (1 << f.type))) && ((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if ((f instanceof IntegerType || f instanceof NullType) && (d instanceof IntegerType || d instanceof NullType)) {
        if (d.toInteger() == 0) {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9306);
            return
        }
        this.set(f.toInteger() % d.toInteger())
    } else {
        this.set(0)
    }
    return this
};
TimeType.prototype.MUL = function(f, d) {
    if (! ((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type))) || !((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type))) || ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.MUL(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
            var g = new DecimalType(null);
            this.set(g.MUL(f, d).toInteger())
        } else {
            this.set(f.toInteger() * d.toInteger())
        }
    }
    return this
};
TimeType.prototype.DIV = function(f, d) {
    if (! (((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) || !(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.DIV(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
            var g = new DecimalType(null);
            this.set(g.DIV(f, d).toInteger())
        } else {
            if (d.toInteger() == 0) {
                getCurWFC_NS(getCurrentWindowID_NS()).status(9306);
                return
            }
            this.set(Math.floor(f.toInteger() / d.toInteger()))
        }
    }
    return this
};
TimeType.prototype.EQ = function(b) {
    if (b.type == 4) {
        b = b.toTime()
    }
    if (b.isNull) {
        return false
    }
    if ((b.type != 7) && (b.type != 2) && (b.type != 14) && (b.type != 13)) {
        return false
    }
    return this.mValue == b.toTime().toInteger()
};
TimeType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
TimeType.prototype.GT = function(b) {
    if (b.isNull) {
        return false
    }
    if (! (b instanceof TimeType) && !(b instanceof IntegerType) && !(b instanceof TODType) && !(b instanceof DateType)) {
        return false
    }
    return this.mValue > b.toTime().toInteger()
};
TimeType.prototype.GE = function(b) {
    if (b.isNull) {
        return false
    }
    if (! (b instanceof TimeType) && !(b instanceof IntegerType) && !(b instanceof TODType) && !(b instanceof DateType)) {
        return false
    }
    return this.mValue >= b.toTime().toInteger()
};
TimeType.prototype.LT = function(b) {
    if (b.isNull) {
        return false
    }
    return ! this.GE(b)
};
TimeType.prototype.LE = function(b) {
    if (b.isNull) {
        return false
    }
    return ! this.GT(b)
};
TimeType.getTimestamp = function(f) {
    var d = -1;
    var b = ARDate.parseDateTime(f);
    if (b == null) {
        b = ARDate.parseDate(f)
    }
    if (b != null) {
        d = b.GTimestamp();
        if (d >= 0 && d <= 2147483647) {
            return d
        }
    }
    d = LCDecimalToEn_US(f, false);
    if (d == 0) {
        d = parseFloat(f)
    }
    d = parseInt(d);
    if (isNaN(d)) {
        d = -1
    }
    return d
};
TimeType.getDateTimeString = function(f, h) {
    var d = parseFloat(f);
    d = parseInt(d);
    if (isNaN(d)) {
        return ""
    }
    if (d < 0) {
        d = 0
    }
    if (d > 2147483647) {
        d = 2147483647
    }
    var b = new ARDate();
    b.STimestamp(d);
    var g;
    if (h == 2) {
        g = localeInfo.dateFormatPattern
    } else {
        if (h == 1) {
            g = localeInfo.timeFormatPattern
        } else {
            g = localeInfo.dateFormatPattern + " " + localeInfo.timeFormatPattern
        }
    }
    return b.format(g, 7)
};
DateType.prototype = new Datatype();
DateType.prototype.constructor = DateType;
DateType.superclass = Datatype.prototype;
DatatypeFactories[13] = function(b) {
    if (typeof b == "object" && b.type == 14 && !(b instanceof TODKWType)) {
        return Null
    }
    return new DateType(b)
};
function DateType(b) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b)
    }
}
DateType.prototype.init = function(b) {
    if (b instanceof Datatype) {
        this.mValue = b.toDate().toInteger()
    } else {
        if (typeof b == "string") {
            if (b.isNumeric()) {
                this.mValue = parseInt(b, 10)
            } else {
                this.mValue = DateType.getDays(b)
            }
        } else {
            this.mValue = b
        }
    }
    this.set(this.mValue)
};
DateType.prototype.set = function(b) {
    if (b < 0) {
        b = 0;
        this.valueAdjusted = true
    } else {
        if (b > 5373120) {
            b = 5373120;
            this.valueAdjusted = true
        }
    }
    this.mValue = b
};
DateType.prototype.type = 13;
DateType.prototype.isNull = false;
DateType.prototype.valueAdjusted = false;
DateType.prototype.toString = function() {
    return DateType.getDateString(this.mValue)
};
DateType.prototype.compareValStr = function() {
    return this.toString()
};
DateType.prototype.toInteger = function() {
    return this.mValue
};
DateType.prototype.toDecimal = function() {
    return new IntegerType(this.toInteger()).toDecimal()
};
DateType.prototype.toReal = function() {
    return this.mValue
};
DateType.prototype.toTOD = function() {
    return Null
};
DateType.prototype.toTime = function() {
    var d = ARDate.getDateObject(this.mValue);
    var b = d.GTimestamp();
    if (b < 0) {
        b = 0
    }
    return new TimeType(b)
};
DateType.prototype.toPrimitive = function() {
    return this.mValue.toString()
};
DateType.prototype.ADD = function(f, d) {
    if (f instanceof CurrencyType || f instanceof TODType || d instanceof TODType || (!(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) && (!(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type))) || (1 << 12 & (1 << d.type))))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (((1 << 4 | 1 << 5) & (1 << f.type))) {
        f = f.toDate()
    }
    if (((1 << 4 | 1 << 5) & (1 << d.type))) {
        d = d.toDate()
    }
    if (f instanceof TimeType || d instanceof TimeType) {
        var g = new TimeType(f.toInteger() + d.toInteger());
        this.set(g.toDate().toInteger())
    } else {
        if (f instanceof RealType || d instanceof RealType) {
            var g = new RealType(0);
            this.set(g.ADD(f, d).toInteger())
        } else {
            if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
                var g = new DecimalType(null);
                this.set(g.ADD(f, d).toInteger())
            } else {
                this.set(f.toInteger() + d.toInteger())
            }
        }
    }
    return this
};
DateType.prototype.SUB = function(f, d) {
    if ((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) && !(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))) || (!(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) && (1 << 12 & (1 << d.type))) || (1 << 14 & (1 << f.type)) || (1 << 14 & (1 << d.type)) || (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (((1 << 4 | 1 << 5) & (1 << f.type))) {
        f = f.toDate()
    }
    if (((1 << 4 | 1 << 5) & (1 << d.type))) {
        d = d.toDate()
    }
    if (f instanceof TimeType) {
        if (d instanceof TimeType) {
            this.set(f.toDate().toInteger() - d.toDate().toInteger())
        } else {
            var g = new TimeType(f.toInteger() - d.toInteger());
            this.set(g.toDate().toInteger())
        }
    } else {
        if (f instanceof RealType || (!(f instanceof DateType) && (d instanceof RealType))) {
            var g = new RealType(0);
            this.set(g.SUB(f, d).toInteger())
        } else {
            if ((f instanceof DecimalType || (!(f instanceof DateType) && (d instanceof DecimalType))) || (f instanceof CurrencyType || (!(f instanceof DateType) && (d instanceof CurrencyType)))) {
                var g = new DecimalType(null);
                this.set(g.SUB(f, d).toInteger())
            } else {
                if (f instanceof CharType) {
                    f = f.toDate()
                }
                this.set(f.toInteger() - d.toInteger())
            }
        }
    }
    return this
};
DateType.prototype.MOD = function(f, d) {
    if (! (((1 << 2 & (1 << f.type)) || (1 << 0 & (1 << f.type))) && ((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if ((f instanceof IntegerType || f instanceof NullType) && (d instanceof IntegerType || d instanceof NullType)) {
        if (d.toInteger() == 0) {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9306);
            return
        }
        this.set(f.toInteger() % d.toInteger())
    } else {
        this.set(0)
    }
    return this
};
DateType.prototype.MUL = function(f, d) {
    if (! (((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) || !(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.MUL(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
            var g = new DecimalType(null);
            this.set(g.MUL(f, d).toInteger())
        } else {
            this.set(f.toInteger() * d.toInteger())
        }
    }
    return this
};
DateType.prototype.DIV = function(f, d) {
    if (! (((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) || !(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.DIV(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
            var g = new DecimalType(null);
            this.set(g.DIV(f, d).toInteger())
        } else {
            if (d.toInteger() == 0) {
                getCurWFC_NS(getCurrentWindowID_NS()).status(9306);
                return
            }
            this.set(Math.floor(f.toInteger() / d.toInteger()))
        }
    }
    return this
};
DateType.prototype.EQ = function(b) {
    if (b.type == 4) {
        b = b.toDate()
    }
    if (b.isNull) {
        return false
    }
    if ((b.type != 7) && (b.type != 2) && (b.type != 14) && (b.type != 13)) {
        return false
    }
    return this.mValue == b.toDate().toInteger()
};
DateType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
DateType.prototype.GT = function(b) {
    if (b.isNull) {
        return false
    }
    if (! (b instanceof TimeType) && !(b instanceof IntegerType) && !(b instanceof TODType) && !(b instanceof DateType)) {
        return false
    }
    return this.mValue > b.toDate().toInteger()
};
DateType.prototype.GE = function(b) {
    if (b.isNull) {
        return false
    }
    if (! (b instanceof TimeType) && !(b instanceof IntegerType) && !(b instanceof TODType) && !(b instanceof DateType)) {
        return false
    }
    return this.mValue >= b.toDate().toInteger()
};
DateType.prototype.LT = function(b) {
    if (b.isNull) {
        return false
    }
    return ! this.GE(b)
};
DateType.prototype.LE = function(b) {
    if (b.isNull) {
        return false
    }
    return ! this.GT(b)
};
DateType.prototype.ADDWEEKS = function(b) {
    return this.ADD(this, new IntegerType(7 * b.toInteger()))
};
DateType.prototype.ADDMONTHS = function(f) {
    var h = ARDate.getDateObject(this.toInteger());
    f = f.toInteger();
    var g;
    if (f < 0) {
        g = h.GYear() - Math.floor( - f / 12)
    } else {
        g = Math.floor(f / 12) + h.GYear()
    }
    var d = (f % 12) + h.GMonth();
    if (d > 12) {
        g += 1;
        d = (d % 12)
    } else {
        if (d < 1) {
            g -= 1;
            d += 12
        }
    }
    var k = h.GDate();
    var b = ARDate.getDaysInMonth(d, g);
    if (k > b) {
        k = b
    }
    h = new ARDate(g, d, k, h.GHour(), h.GMinute(), h.GSecond());
    this.set(h.GDays());
    return this
};
DateType.prototype.ADDYEARS = function(b) {
    var d = ARDate.getDateObject(this.toInteger());
    d = new ARDate(d.GYear() + b.toInteger(), d.GMonth(), d.GDate(), d.GHour(), d.GMinute(), d.GSecond());
    this.set(d.GDays());
    return this
};
DateType.getDays = function(f) {
    var d = -1;
    var b = ARDate.parseDate(f);
    if (b != null) {
        d = b.GDays();
        if (d >= 0 && d <= 5373120) {
            return d
        }
    }
    var g = ARDate.parseTime(f);
    if (g != null) {
        return (new DateKWType()).mValue
    }
    d = LCDecimalToEn_US(f, false);
    if (d == 0) {
        d = parseFloat(f)
    }
    d = parseInt(d);
    if (isNaN(d)) {
        d = -1
    }
    return d
};
DateType.getDateString = function(f) {
    var d = parseFloat(f);
    d = parseInt(d);
    if (isNaN(d)) {
        return ""
    }
    if (d < 0) {
        d = 0
    }
    if (d > 5373120) {
        d = 5373120
    }
    var b = new ARDate();
    b.SDays(d);
    return b.format(localeInfo.dateFormatPattern, 13)
};
TODType.prototype = new Datatype();
TODType.prototype.constructor = TODType;
TODType.superclass = Datatype.prototype;
DatatypeFactories[14] = function(b) {
    if (typeof b == "object" && b.type == 13 && !(b instanceof DateKWType)) {
        return Null
    }
    return new TODType(b)
};
function TODType(b) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b)
    }
}
TODType.prototype.init = function(b) {
    if (b instanceof Datatype) {
        this.mValue = b.toTOD().toInteger()
    } else {
        if (typeof b == "string") {
            this.mValue = (b.isNumeric()) ? parseInt(b, 10) : TODType.convertStringToTime(b)
        } else {
            this.mValue = b
        }
    }
    this.set(this.mValue)
};
TODType.prototype.set = function(b) {
    if (b < 0) {
        b = 0;
        this.valueAdjusted = true
    } else {
        if (b > 86399) {
            b = 86399;
            this.valueAdjusted = true
        }
    }
    this.mValue = b
};
TODType.prototype.type = 14;
TODType.prototype.isNull = false;
TODType.prototype.valueAdjusted = false;
TODType.prototype.getTimeObj = function() {
    var f = Math.floor(this.mValue / 3600);
    var b = Math.floor((this.mValue - (f * 3600)) / 60);
    var d = Math.floor((this.mValue - (f * 3600)) - (b * 60));
    return {
        h: f,
        m: b,
        s: d
    }
};
TODType.prototype.toTime = function() {
    return new TimeType(this.toString())
};
TODType.prototype.toDate = function() {
    return Null
};
TODType.prototype.toInteger = function() {
    return this.mValue
};
TODType.prototype.toDecimal = function() {
    return new IntegerType(this.toInteger()).toDecimal()
};
TODType.prototype.toReal = function() {
    return this.mValue
};
TODType.prototype.toString = function() {
    return TODType.convertNumberToTime(this.mValue)
};
TODType.prototype.compareValStr = function() {
    return this.toString()
};
TODType.prototype.toPrimitive = function() {
    return this.mValue.toString()
};
TODType.prototype.ADD = function(f, d) {
    if (f instanceof CurrencyType || f instanceof DateType || d instanceof DateType || (!(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) && (!(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type))) || (1 << 12 & (1 << d.type))))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (((1 << 4 | 1 << 5) & (1 << f.type))) {
        f = f.toTOD()
    }
    if (((1 << 4 | 1 << 5) & (1 << d.type))) {
        d = d.toTOD()
    }
    if (f instanceof TimeType || d instanceof TimeType) {
        var g = new TimeType(f.toInteger() + d.toInteger());
        this.set(g.toTOD().toInteger())
    } else {
        if (f instanceof RealType || d instanceof RealType) {
            var g = new RealType(0);
            this.set(g.ADD(f, d).toInteger())
        } else {
            if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
                var g = new DecimalType(null);
                this.set(g.ADD(f, d).toInteger())
            } else {
                this.set(f.toInteger() + d.toInteger())
            }
        }
    }
    return this
};
TODType.prototype.SUB = function(f, d) {
    if ((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) && !(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))) || (!(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) && (1 << 12 & (1 << d.type))) || ((1 << 13 & (1 << f.type)) || (1 << 13 & (1 << d.type))) || (((1 << 7 | 1 << 13 | 1 << 14) & (1 << f.type)) && ((1 << 7 | 1 << 13 | 1 << 14) & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (((1 << 4 | 1 << 5) & (1 << f.type))) {
        f = f.toTOD()
    }
    if (((1 << 4 | 1 << 5) & (1 << d.type))) {
        d = d.toTOD()
    }
    if (f instanceof TimeType) {
        if (d instanceof TimeType) {
            this.set(f.toTOD().toInteger() - d.toTOD().toInteger())
        } else {
            var g = new TimeType(f.toInteger() - d.toInteger());
            this.set(g.toTOD().toInteger())
        }
    } else {
        if (f instanceof RealType || (!(f instanceof TODType) && (d instanceof RealType))) {
            var g = new RealType(0);
            this.set(g.SUB(f, d).toInteger())
        } else {
            if ((f instanceof DecimalType || (!(f instanceof TODType) && (d instanceof DecimalType))) || (f instanceof CurrencyType || (!(f instanceof TODType) && (d instanceof CurrencyType)))) {
                var g = new DecimalType(null);
                this.set(g.SUB(f, d).toInteger())
            } else {
                if (f instanceof CharType) {
                    f = f.toTOD()
                }
                this.set(f.toInteger() - d.toInteger())
            }
        }
    }
    return this
};
TODType.prototype.MOD = function(f, d) {
    if (! (((1 << 2 & (1 << f.type)) || (1 << 0 & (1 << f.type))) && ((((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if ((f instanceof IntegerType || f instanceof NullType) && (d instanceof IntegerType || d instanceof NullType)) {
        if (d.toInteger() == 0) {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9306);
            return
        }
        this.set(f.toInteger() % d.toInteger())
    } else {
        this.set(0)
    }
    return this
};
TODType.prototype.MUL = function(f, d) {
    if (! (((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) || !(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.MUL(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
            var g = new DecimalType(null);
            this.set(g.MUL(f, d).toInteger())
        } else {
            this.set(f.toInteger() * d.toInteger())
        }
    }
    return this
};
TODType.prototype.DIV = function(f, d) {
    if (! (((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << f.type)) | (1 << 0 & (1 << f.type))) || !(((1 << 2 | 1 << 3 | 1 << 10 | 1 << 12) & (1 << d.type)) | (1 << 0 & (1 << d.type)))) {
        getCurWFC_NS(getCurrentWindowID_NS()).status(9339);
        return
    }
    if (f instanceof RealType || d instanceof RealType) {
        var g = new RealType(0);
        this.set(g.DIV(f, d).toInteger())
    } else {
        if (f instanceof DecimalType || d instanceof DecimalType || f instanceof CurrencyType || d instanceof CurrencyType) {
            var g = new DecimalType(null);
            this.set(g.DIV(f, d).toInteger())
        } else {
            if (d.toInteger() == 0) {
                getCurWFC_NS(getCurrentWindowID_NS()).status(9306);
                return
            }
            this.set(Math.floor(f.toInteger() / d.toInteger()))
        }
    }
    return this
};
TODType.prototype.EQ = function(b) {
    if (b.type == 4) {
        b = b.toTOD(b)
    }
    if (b.isNull) {
        return false
    }
    if ((b.type != 14) && (b.type != 2)) {
        return false
    }
    return this.mValue == b.toInteger()
};
TODType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
TODType.prototype.GT = function(b) {
    if (b.isNull) {
        return false
    }
    if (! (b instanceof TODType) && !(b instanceof IntegerType)) {
        return false
    }
    return this.mValue > b.toInteger()
};
TODType.prototype.GE = function(b) {
    if (b.isNull) {
        return false
    }
    if (! (b instanceof TODType) && !(b instanceof IntegerType)) {
        return false
    }
    return this.mValue >= b.toInteger()
};
TODType.prototype.LT = function(b) {
    if (b.isNull) {
        return false
    }
    return ! this.GE(b)
};
TODType.prototype.LE = function(b) {
    if (b.isNull) {
        return false
    }
    return ! this.GT(b)
};
TODType.convertStringToTime = function(f) {
    var d = -1;
    var b = ARDate.parseTime(f);
    if (b != null) {
        d = b.GTimeOfDay()
    } else {
        d = parseFloat(f);
        d = parseInt(d);
        if (isNaN(d)) {
            d = -1
        }
    }
    return d
};
TODType.convertNumberToTime = function(g) {
    var d = parseFloat(g);
    d = parseInt(g);
    if (isNaN(d)) {
        return ""
    }
    if (d < 0) {
        d = 0
    }
    if (d > 86399) {
        d = 86399
    }
    var b = new ARDate();
    var f = d % 60;
    b.SSecond(f);
    b.SMinute(((d - f) % 3600) / 60);
    b.SHour(Math.floor(d / 3600));
    return b.format(localeInfo.timeFormatPattern, 14)
};
TODType.convertToTime = function(h, f, g, b) {
    var d = localeInfo.timeSeparator;
    return h + d + f + d + g
};
EnumType.prototype = new Datatype();
EnumType.prototype.constructor = EnumType;
EnumType.superclass = Datatype.prototype;
DatatypeFactories[6] = function(k, b) {
    if (typeof b != "undefined" && "l" in b) {
        return new EnumType(k, b.l)
    }
    if (k instanceof Datatype) {
        if (k.type != 4) {
            return new EnumType(k)
        }
        k = k.toString()
    }
    var g = /^([0-9]+) (.*)$/;
    if (g.test(k)) {
        return new EnumType(k.replace(g, "$1"), k.replace(g, "$2"))
    }
    if (typeof k == "string") {
        if (typeof b != "undefined" && "el" in b) {
            var d = b.el;
            for (i in d) {
                if (k == d[i]) {
                    return new EnumType(i, k)
                }
            }
        }
        var h = parseFloat(k);
        k = parseInt(h);
        if (isNaN(k)) {
            return Null
        }
    }
    return new EnumType(k)
};
function EnumType(f, d) {
    if (arguments.length && !(typeof f == "undefined")) {
        this.init(f, d)
    }
}
EnumType.prototype.init = function(b, d) {
    if (b instanceof Datatype) {
        this.mValue = b.toInteger()
    } else {
        if (typeof b == "string") {
            var g = parseFloat(b);
            this.mValue = parseInt(g);
            if (isNaN(this.mValue)) {
                this.mValue = 0
            }
        } else {
            this.mValue = b
        }
    }
    this.mLabel = d
};
EnumType.prototype.type = 6;
EnumType.prototype.isNull = false;
EnumType.prototype.toInteger = function() {
    return this.mValue
};
EnumType.prototype.toReal = function() {
    return this.mValue
};
EnumType.prototype.toDecimal = function() {
    return new BigDecimal("" + this.mValue)
};
EnumType.prototype.toString = function() {
    if (typeof this.mLabel == "undefined") {
        return this.mValue.toString()
    }
    return this.mLabel.HTMLDecode()
};
EnumType.prototype.compareValStr = function() {
    return this.mValue.toString()
};
EnumType.prototype.toTime = function() {
    if (this.toString().isNumeric() || ARDate.parseDateTime(this.toString()) != null) {
        return new TimeType(this.toString())
    } else {
        return new TimeType(this.toInteger())
    }
};
EnumType.prototype.toDate = function() {
    if (this.toString().isNumeric() || ARDate.parseDate(this.toString()) != null) {
        return new DateType(this.toString())
    } else {
        return new DateType(this.toInteger())
    }
};
EnumType.prototype.toTOD = function() {
    if (this.toString().isNumeric() || ARDate.parseTime(this.toString()) != null) {
        return new TODType(this.toString())
    } else {
        return new TODType(this.toInteger())
    }
};
EnumType.prototype.toPrimitive = function() {
    var b;
    if (typeof this.mLabel == "undefined") {
        b = this.mValue
    } else {
        b = this.mLabel.HTMLDecode()
    }
    return this.mValue + " " + b
};
EnumType.prototype.args = function() {
    if (typeof this.mLabel == "undefined") {
        return {}
    } else {
        return {
            l: this.mLabel.HTMLDecode()
        }
    }
};
EnumType.prototype.EQ = function(b) {
    if (b.isNull) {
        return false
    }
    if (b.type == 4) {
        var d = b.toString();
        if (this.mLabel.HTMLDecode() == d) {
            return true
        } else {
            return false
        }
    }
    return this.mValue == b.toInteger()
};
EnumType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
EnumType.prototype.GT = function(b) {
    return this.mValue > b.toInteger()
};
EnumType.prototype.GE = function(b) {
    return this.mValue >= b.toInteger()
};
EnumType.prototype.LT = function(b) {
    return ! this.GE(b)
};
EnumType.prototype.LE = function(b) {
    return ! this.GT(b)
};
StatusHistoryType.prototype = new CharType();
StatusHistoryType.prototype.constructor = StatusHistoryType;
StatusHistoryType.superclass = CharType.prototype;
function StatusHistoryType(b) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b)
    }
}
StatusHistoryType.prototype.part = function(b, f) {
    var d = this.GetArray();
    if (b >= 0 && b < d.length) {
        if (f == 2) {
            return (d[b].t == null) ? Null: new TimeType(d[b].t)
        } else {
            return (d[b].u == null) ? Null: new CharType(d[b].u)
        }
    }
    return Null
};
StatusHistoryType.prototype.compound = function(f) {
    if (f.length != 2) {
        return null
    }
    var d = f[0].toUpperCase();
    if (d == "TIME") {
        d = 2
    } else {
        if (d == "USER") {
            d = 1
        } else {
            if (d.isDigits()) {
                d = parseInt(d)
            } else {
                return null
            }
        }
    }
    if (d != 1 && d != 2) {
        return null
    }
    var b;
    if (f[1].isDigits()) {
        b = parseInt(f[1])
    } else {
        for (b = 0; b < getStatusEnumInfo_NS(getCurrentWindowID_NS()).length; ++b) {
            if (f[1] == getStatusEnumInfo_NS(getCurrentWindowID_NS())[b].m) {
                break
            }
        }
    }
    if (b < 0 || b >= getStatusEnumInfo_NS(getCurrentWindowID_NS()).length) {
        return null
    }
    return this.part(b, d)
};
StatusHistoryType.prototype.GetArray = function() {
    if (this.mValue == null) {
        return []
    }
    var g = this.mValue.split("\03");
    var f = new Array();
    for (var d = 0; d < getStatusEnumInfo_NS(getCurrentWindowID_NS()).length; ++d) {
        if (g[d]) {
            var b = g[d].split("\04");
            if (b.length == 2) {
                f.push({
                    t: b[0],
                    u: b[1]
                });
                continue
            }
        }
        f.push({
            t: null,
            u: null
        })
    }
    return f
};
StatusHistoryType.prototype.GetTable = function() {
    var f = this.GetArray();
    var d = [[getLocalizedMessage("Status"), getLocalizedMessage("Modified Time"), getLocalizedMessage("Modified By")]];
    for (var b = 0; b < f.length; ++b) {
        d[b + 1] = [getStatusEnumInfo_NS(getCurrentWindowID_NS())[b].l, (f[b].t == null) ? "": new TimeType(f[b].t).toString(), (f[b].u == null) ? "": f[b].u]
    }
    return d
};
StatusHistoryType.prototype.toReal = function() {
    return new RealType(this.toInteger()).toReal()
};
StatusHistoryType.prototype.toDecimal = function() {
    return new IntegerType(this.toInteger()).toDecimal()
};
AttachmentType.prototype = new Datatype();
AttachmentType.prototype.constructor = AttachmentType;
AttachmentType.superclass = Datatype.prototype;
DatatypeFactories[11] = function(d, b) {
    return new AttachmentType(d)
};
function AttachmentType(b) {
    if (arguments.length) {
        this.init(b)
    }
}
AttachmentType.NO_SCREEN_TYPE_PAT = /^1\/0/;
AttachmentType.WITH_SCREEN_KEY_PREFIX = "1/1";
AttachmentType.prototype.init = function(k) {
    AttachmentType.superclass.init.call(this);
    this.mOrigSize = this.mFileName = "";
    this.mValue = this.mDataKey = "";
    if (k instanceof AttachmentType) {
        if (k.isNull) {
            this.isNull = true
        } else {
            this.mValue = k.mValue;
            this.mOrigSize = k.mOrigSize;
            this.mFileName = k.mFileName;
            this.mDataKey = k.mDataKey
        }
    } else {
        if (k instanceof Datatype) {
            var d = k.toAttach();
            if (d.isNull) {
                this.isNull
            } else {
                this.mValue = d.mValue;
                this.mOrigSize = d.mOrigSize;
                this.mFileName = d.mFileName;
                this.mDataKey = d.mDataKey
            }
        } else {
            if (typeof k == "string") {
                try {
                    var g = k.indexOf("/");
                    if (g <= 0) {
                        throw f
                    }
                    var b = parseInt(k.substring(0, g));
                    if (b <= 1) {
                        throw f
                    }
                    this.mDataKey = k.substr(++g, b);
                    g += b;
                    var h = k.indexOf("/", g);
                    b = parseInt(k.substring(g, h));
                    if (b <= 0) {
                        throw f
                    }
                    this.mOrigSize = k.substr(++h, b);
                    g = h + b;
                    h = k.indexOf("/", g);
                    b = parseInt(k.substring(g, h));
                    if (b <= 0) {
                        throw f
                    }
                    this.mFileName = k.substr(++h, b);
                    if (this.mDataKey.charAt(2) == "0") {
                        this.mDataKey = this.mDataKey.replace(AttachmentType.NO_SCREEN_TYPE_PAT, AttachmentType.WITH_SCREEN_KEY_PREFIX);
                        this.mDataKey += window.name.length + "/" + window.name;
                        this.mValue = this.mDataKey.length + "/" + this.mDataKey;
                        this.mValue += this.mOrigSize.length + "/" + this.mOrigSize;
                        this.mValue += this.mFileName.length + "/" + this.mFileName
                    } else {
                        this.mValue = k
                    }
                } catch(f) {
                    this.isNull = true
                }
            } else {
                this.isNull = true
            }
        }
    }
};
AttachmentType.prototype.toChar = function() {
    return this.toString()
};
AttachmentType.prototype.toString = function() {
    return this.mFileName
};
AttachmentType.prototype.compareValStr = function() {
    return this.toString()
};
AttachmentType.prototype.toAttach = function() {
    return this
};
AttachmentType.prototype.toURL = function() {
    return new CharType(JAttachment.getURL(this.mDataKey))
};
AttachmentType.prototype.toPrimitive = function() {
    return this.mValue
};
AttachmentType.prototype.EQ = function(d) {
    if (d.isNull) {
        return false
    }
    var b = this.mFileName;
    var f = d.toChar();
    if (b == null || f == null) {
        return (b == null && f == null)
    }
    return b.localeCompare(f) == 0
};
AttachmentType.prototype.NE = function(b) {
    return ! this.EQ(b)
};
AttachmentType.prototype.GT = function(d) {
    var b = this.mFileName;
    var f = d.toChar();
    if (b == null || f == null) {
        return (b == null && f == null)
    }
    return b.localeCompare(f) > 0
};
AttachmentType.prototype.LT = function(d) {
    var b = this.mFileName;
    var f = d.toChar();
    if (b == null || f == null) {
        return (b == null && f == null)
    }
    return b.localeCompare(f) < 0
};
AttachmentType.prototype.GE = function(d) {
    var b = this.mFileName;
    var f = d.toChar();
    if (b == null || f == null) {
        return (b == null && f == null)
    }
    return b.localeCompare(f) >= 0
};
AttachmentType.prototype.LE = function(d) {
    var b = this.mFileName;
    var f = d.toChar();
    if (b == null || f == null) {
        return (b == null && f == null)
    }
    return b.localeCompare(f) <= 0
};
AttachmentType.prototype.LIKE = function(d) {
    var b = this.mFileName;
    var h = d.toChar();
    if (b == null || h == null) {
        return false
    }
    h = h.replace(/(%)|(_)|(\[.*\])|([.$^+?*{()\\\/|[\]])/gm,
    function(k, s, q, p, o) {
        if (s) {
            return ".*"
        } else {
            if (q) {
                return "."
            } else {
                if (p) {
                    return p
                } else {
                    if (o) {
                        return "\\" + o
                    }
                }
            }
        }
    });
    try {
        var g = new RegExp("^" + h + "$")
    } catch(f) {
        return false
    }
    return b.match(g) != null
};
AttachmentType.prototype.type = 11;
AttachmentType.prototype.isNull = false;
AttachmentType.getKey = function(g, h, q, f) {
    var d = [];
    var b = F(f, 1).G();
    if (g == "3" && h >= 3000000 && h <= 3999999) {
        b = Null
    }
    var o = ["1", ARKWGetStringByIdx(f, 7), ARKWGetStringByIdx(f, 6), b.IsNull ? "": b.toString(), h + "", window.name];
    for (var v in o) {
        d.push(o[v].length);
        d.push("/");
        d.push(o[v])
    }
    var u = d.join("");
    var p = [];
    p.push(g.length);
    p.push("/");
    p.push(g);
    p.push(u.length);
    p.push("/");
    p.push(u);
    if (g == "4" && q) {
        var s = q.length + "";
        p.push(s.length);
        p.push("/");
        p.push(s);
        for (var v in q) {
            var h = q[v];
            var k = h + "";
            p.push(k.length);
            p.push("/");
            p.push(k)
        }
    }
    return p.join("")
};
AttachmentType.getKeyForCurrentField = function(d, b) {
    return AttachmentType.getKey("3", d, null, b)
};
AttachmentType.getKeyForPoolField = function(d, f, b) {
    return AttachmentType.getKey("4", d, f, b)
};
AttachmentType.prototype.toCurrency = function(b) {
    return new CurrencyType(this.toString(), b, true)
};
function getDocument() {
    return document
}
function getBody() {
    return document.body
}
function getDocumentSelection() {
    return document.selection
}
function Field_FromElement(g) {
    var f = document.body;
    while (g && g != f) {
        if (g.nodeType == 1) {
            if (g.getAttribute("arstop") == "1") {
                return null
            }
            var d = g.getAttribute("arid");
            if (d) {
                var b = g.getAttribute("arwindowid");
                return getFields_NS(parseInt(b))[d]
            }
        }
        g = g.parentNode
    }
    return null
}
function Window_FromElement(f) {
    var d = document.body;
    while (f && f != d) {
        if (f.nodeType == 1) {
            var b = "" + f.getAttribute("arwindowid");
            if (!isNaN(b)) {
                return parseInt(b)
            }
        }
        f = f.parentNode
    }
    return 0
}
Field.prototype.constructor = Field;
var DOMFieldFactories = {};
var JFieldFactories = {};
var TPAFieldFactories = {};
function Field_Unload(b) {
    var f = getFields_NS(b);
    for (var d in f) {
        var g = f[d];
        g.Unload()
    }
}
Field.prototype.mCFCache = new CFCacheObj();
function CFCacheObj(b) {
    if (arguments.length) {
        for (var d in b) {
            this[d] = b[d]
        }
    }
}
CFCacheObj.prototype.a = 2;
CFCacheObj.prototype.l = "";
CFCacheObj.prototype.c = "inherit";
CFCacheObj.prototype.f = "f1";
CFCacheObj.prototype.v = true;
CFCacheObj.prototype.m = null;
CFCacheObj.prototype.drag = false;
CFCacheObj.prototype.drop = false;
CFCacheObj.prototype.o = 2;
Field.mMinWidth = 20;
Field.mMinHeight = 20;
function Field(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
Field.prototype.init = function(b, k, g) {
    this.windowID = b;
    this.mID = k;
    this.mObj = g;
    this.mLayoutFields = {};
    if (!this.mDOMField && g != null && (!("v" in g))) {
        this.mObj.v = Null;
        this.mObj.windowID = b
    }
    if (k == 0) {
        return
    }
    this.mCFCache = new CFCacheObj(getDefaults_NS(this.windowID)[k]);
    getFields_NS(this.windowID)[k] = this;
    if (this.mID >= 1000000 && this.mID <= 1999999) {
        this.ReadGlobalData()
    }
    this.perWidth = 100;
    this.perHeight = 0;
    this.mHasChildFields = false;
    this.mFillModel = null;
    this.mMinWidth = Field.mMinWidth;
    this.mMaxWidth = 32767;
    this.mMinHeight = Field.mMinHeight;
    this.mMaxHeight = 32767;
    this.mAutoSizeHeight = false;
    this.mAutoSizeWidth = false;
    this.mIFrame = null;
    if (!this.mDOMField) {
        return
    }
    this.mObj.setAttribute("arwindowid", b);
    var f = this.mObj.getAttribute("arcontainerid");
    if (f != null) {
        this.mContainerID = parseInt(f);
        this.mObj.style.position = "relative";
        this.mObj.style.top = "auto";
        this.mObj.style.left = "auto";
        if (this.mObj.style.visibility != "hidden" && this.mObj.style.display != "none") {
            if (this.mContainerID != 0) {
                getFields_NS(this.windowID)[this.mContainerID].RegisterLayoutField(this, false)
            } else {
                getVUILayoutModel_NS(this.windowID).RegisterLayoutField(this, false)
            }
            this.perWidth = parseInt(this.mObj.getAttribute("arpercentwidth"));
            this.perHeight = parseInt(this.mObj.getAttribute("arpercentheight"));
            if (this.mObj.getAttribute("arminwidth") != null) {
                this.mMinWidth = parseInt(this.mObj.getAttribute("arminwidth"))
            }
            if (this.mObj.getAttribute("armaxwidth") != null) {
                this.mMaxWidth = parseInt(this.mObj.getAttribute("armaxwidth"))
            }
            if (this.mObj.getAttribute("arminheight") != null) {
                this.mMinHeight = parseInt(this.mObj.getAttribute("arminheight"))
            }
            if (this.mObj.getAttribute("armaxheight") != null) {
                this.mMaxHeight = parseInt(this.mObj.getAttribute("armaxheight"))
            }
        }
    } else {
        if (this.mFloat == 2) {
            var h = this.mObj.getAttribute("arminwidth");
            var d = this.mObj.getAttribute("arminheight");
            if (h != null) {
                this.mMinWidth = parseInt(h);
                if (this.mMinWidth < Field.mMinWidth) {
                    this.mMinWidth = Field.mMinWidth
                }
                this.mResize = true
            }
            if (d != null) {
                this.mMinHeight = parseInt(d);
                if (this.mMinHeight < Field.mMinHeight) {
                    this.mMinHeight = Field.mMinHeight
                }
                this.mResize = true
            }
        }
    }
};
Field.prototype.SaveGlobalData = function() {
    if (this.mID >= 1000000 && this.mID <= 1999999) {
        this.SetCookieValue()
    }
};
Field.prototype.GetCookieValue = function() {
    var b = DeserializeGlobals("GF");
    if (b != null && this.mID in b) {
        return Datatype_Factory(b[this.mID])
    }
    return null
};
Field.prototype.SetCookieValue = function() {
    var b = DeserializeGlobals("GF");
    b[this.mID] = this.SerializeVal();
    SerializeGlobals(this.windowID, "GF", b);
    wm.lasttimeCookieUpdated = (new Date()).getTime();
    FieldList.SetAllLogicalChildrenGlobals(this.windowID, true)
};
Field.prototype.ReadGlobalData = function() {
    if (this.mID >= 1000000 && this.mID <= 1999999) {
        if (! ("mDCF" in this)) {
            this.mDCF = (this.mDOMField) ? (this.mObj.getAttribute("ardcf") != null) : ((this.mObj && "dcf" in this.mObj) ? (this.mObj.dcf == 1) : false)
        }
        var b = this.GetCookieValue();
        if (b != null) {
            if (b.type != this.G().type || b.toPrimitive() != this.G().toPrimitive() || (this.mDOMField && this.mHaveStoredData && b.toString() != this.GetScreenValAsPrimitive())) {
                this.DoSet(b)
            }
        }
    }
};
Field.prototype.SerializeVal = function() {
    var b = this.G();
    if ("args" in b) {
        return {
            t: b.type,
            v: b.toPrimitive(),
            a: b.args()
        }
    } else {
        return {
            t: b.type,
            v: b.toPrimitive()
        }
    }
};
Field.prototype.DeserializeVal = function(b) {
    this.S(Datatype_Factory(b))
};
Field.prototype.G = function() {
    return Null
};
Field.prototype.GTrim = function() {
    return this.G()
};
Field.prototype.GP = function() {
    return Null
};
Field.prototype.IsNullKeyword = function() {
    if ("GetScreenValAsPrimitive" in this) {
        var b = this.GetScreenValAsPrimitive();
        if (b != "") {
            var d = {
                hasKeyword: false,
                hasTemporalKeyword: false
            };
            b = ExpandString(this.windowID, b, 2 | 4, this.mID, this.mDataType, d);
            if (d.hasKeyword && b == "") {
                return true
            }
        }
    }
    return false
};
Field.prototype.GetQBEValue = function() {
    if (this.IsNullKeyword()) {
        return NullType.KEYWORD_NULL
    }
    return this.G()
};
Field.GetQBEOperator = function(d) {
    var b = /^(\<\=|\>\=|\=|!\=|\<\>|\<|\>)(.*)/;
    if (b.test(d)) {
        return d.replace(b, "$1")
    }
    return null
};
Field.prototype.SLoadEntry = function(b) {
    this.DoSLoadEntry(b);
    this.SaveGlobalData()
};
Field.prototype.DoSLoadEntry = function(b) {
    return this.DoSet(b)
};
Field.prototype.FieldValChanged = function() {};
Field.prototype.S = function(k) {
    if (typeof k == "undefined") {
        return
    }
    if (! ("mDCF" in this) && this.mID != 0) {
        this.mDCF = (this.mDOMField) ? (this.mObj.getAttribute("ARDCF") != null) : ((this.mObj && "dcf" in this.mObj) ? (this.mObj.dcf == 1) : false)
    }
    bCheckFirst = !this.mDCF;
    if (bCheckFirst) {
        bCheckFirst = !getFieldChanged_NS(this.windowID)
    } else {
        bCheckFirst = (this.mObj && "dcf" in this.mObj && this.mObj.dcf == 1)
    }
    if (bCheckFirst) {
        var g = this.G();
        if (g) {
            var h;
            if (k instanceof Datatype) {
                h = k
            } else {
                h = DatatypeFactories[g.type](k)
            }
            var b = false;
            if (this.mID >= 1000000 && this.mID <= 1999999) {
                var d = this.GetCookieValue();
                if (d == null) {
                    if (k != null) {
                        b = true
                    }
                } else {
                    b = d.EQForSet(h)
                }
            }
            if (g.EQForSet(h) && (!(this.mDOMField && this.mHaveStoredData) || h.toString() == this.GetScreenValAsPrimitive()) && !(this instanceof DView) && !b) {
                return
            }
        } else {
            if (!k) {
                return
            }
        }
    }
    var f = this.DoSet(k);
    if (!f && this == DummyField) {
        this.mObj.v = k
    }
    this.mCursorRange = null;
    this.SaveGlobalData();
    delete getARMaps_NS(this.windowID)[this.mID];
    delete getARArrays_NS(this.windowID)[this.mID];
    return f
};
Field.prototype.DoSet = function(b) {};
Field.prototype.Validate = function() {
    return null
};
Field.prototype.GName = function() {
    if (this.mDOMField) {
        return this.mObj.getAttribute("ardbn")
    } else {
        return this.mObj.dbn
    }
};
Field.prototype.mContainFields = false;
Field.prototype.mDOMField = false;
Field.prototype.mHaveVisualCharacteristics = false;
Field.prototype.GLabel = function() {
    return this.mCFCache.l
};
Field.prototype.GLabelOrName = function() {
    if (this.GLabel().length > 0) {
        return this.GLabel()
    }
    return this.GName()
};
Field.prototype.GLabelOrID = function() {
    if ("mOrigLabel" in this) {
        return this.mID + ""
    } else {
        return this.GLabel()
    }
};
Field.prototype.GColour = function() {
    if (this.mCFCache.c == null && this.mID in getDefaults_NS(this.windowID)) {
        return getDefaults_NS(this.windowID)[this.mID].c
    }
    return this.mCFCache.c
};
Field.prototype.GFont = function() {
    return this.mCFCache.f
};
Field.prototype.GAccess = function() {
    return this.mCFCache.a
};
Field.prototype.GVis = function() {
    return this.mCFCache.v
};
Field.prototype.GMenu = function() {
    return this.mCFCache.m
};
Field.prototype.GDraggable = function() {
    return this.mCFCache.drag
};
Field.prototype.GDroppable = function() {
    return this.mCFCache.drop
};
Field.prototype.SLabel = function(b) {
    if (this.mCFCache.l != b) {
        if (! ("mOrigLabel" in this)) {
            this.mOrigLabel = this.mCFCache.l
        }
        this.mCFCache.l = b;
        this.UpdateLabel(b)
    }
};
Field.prototype.SColour = function(b) {
    if (this.mCFCache.c != b) {
        this.mCFCache.c = b;
        this.UpdateColour(b)
    }
};
Field.prototype.SFont = function(b) {
    if (this.mCFCache.f != b) {
        this.mCFCache.f = b;
        this.UpdateFont(b)
    }
};
Field.prototype.SAccess = function(b) {
    if (this.mCFCache.a != b) {
        this.mCFCache.a = b;
        this.UpdateAccess(b)
    }
};
Field.prototype.SVis = function(d) {
    if (this.mCFCache.v != d) {
        this.mCFCache.v = d;
        this.UpdateVis(d);
        if (this.mContainerID != null) {
            var b = getVUILayoutModel_NS(this.windowID);
            if (this.mContainerID != 0) {
                b = getFields_NS(this.windowID)[this.mContainerID].mFillModel
            }
            if (!d) {
                b.DeRegisterLayoutField(this.mID)
            } else {
                b.RegisterLayoutField(this, true)
            }
        } else {
            if (this.mFillModel) {
                if (d) {
                    this.ResizeChildren()
                }
            }
        }
    }
};
Field.prototype.SDraggable = function(b) {
    if (this.mCFCache.drag != b) {
        this.mCFCache.drag = b;
        this.UpdateDraggable(b)
    }
};
Field.prototype.SDroppable = function(b) {
    if (this.mCFCache.drop != b) {
        this.mCFCache.drop = b;
        this.UpdateDroppable(b)
    }
};
Field.prototype.ResizeChildren = function() {};
Field.prototype.SMenu = function(d) {
    if (this.mCFCache.m != d) {
        this.UpdateMenu(d);
        if (d != null && d.length > 2 && (d.charAt(0) == "$" && d.charAt(d.length - 1) == "$")) {
            var b = d.substring(1, d.length - 1);
            if (!isNaN(b)) {
                d = ExpandString(this.windowID, d, 1)
            }
        }
        this.mCFCache.m = d;
        if (this instanceof DChar) {
            this.mAutoCompleteCreated = false
        }
    } else {
        if ((d in getARMenuCache_NS(this.windowID)) && !(getARMenuCache_NS(this.windowID)[d] instanceof Object)) {
            return
        } else {
            if ((d in getARMenuCache_NS(this.windowID)) && !(getARMenuCache_NS(this.windowID)[d].mMenuData instanceof Array)) {
                getARMenuCache_NS(this.windowID)[d].mCharFieldMenu = null
            }
        }
    }
};
Field.prototype.UpdateAccess = function(b) {};
Field.prototype.UpdateMenu = function(b) {};
Field.prototype.GMenuStyle = function() {
    return 1
};
Field.prototype.TracksCaret = false;
Field.prototype.hasContextMenu = false;
Field.prototype.Clear = function() {
    var b = this.mID;
    if ((b >= 1000000 && b <= 1999999) || (b >= 3000000 && b <= 3999999) || b == 1576 || b == 1575) {
        return
    }
    this.mObj.v = Null;
    this.SetDirty()
};
Field.prototype.DataDefault = function() {
    if ((this.mID >= 1000000 && this.mID <= 1999999) || (this.mID >= 3000000 && this.mID <= 3999999)) {
        return
    }
    var b = this.GDefault();
    if (b != null) {
        this.S(b)
    }
};
Field.prototype.GDefault = function() {
    if ("d" in getDefaults_NS(this.windowID)[this.mID]) {
        return (new CharType(ExpandString(this.windowID, "" + getDefaults_NS(this.windowID)[this.mID].d, 2)))
    } else {
        return (Null)
    }
};
Field.prototype.MouseSelectable = true;
Field.prototype.mHaveStoredData = false;
Field.prototype.IsMouseSelectable = function() {
    return this.MouseSelectable
};
Field.prototype.QueryOK = function() {
    return this.mHaveStoredData
};
Field.prototype.hasChildFields = function() {
    return this.mHasChildFields
};
Field.prototype.getChildField = function() {
    return null
};
function Field_BuildList(f, B, s, A, o, b, C, w) {
    var v;
    if (A) {
        var g = new FieldSnapshot(f, true, false, true);
        if (getDBSnapshot_NS(f) != null) {
            v = getDBSnapshot_NS(f).DataDiff(g)
        } else {
            modifiedOnly = false
        }
    }
    var k = [];
    var y = false;
    var d = getFields_NS(f);
    for (var D in d) {
        var p = d[D];
        if (p.mHaveStoredData) {
            var E = (C) ? p.GTrim() : p.G();
            if (o && (E == Null || E == CharNull)) {
                if (b || (p.mDataType != 6 && !(p instanceof JAttachment)) || (p.mLastChanged && getField_LastCleared_NS(f) > p.mLastChanged)) {
                    if (w && p instanceof DataField) {
                        if (p.mCFCache.o == 1 || (p.mCFCache.r == 1)) {
                            var q = p.GDefault();
                            if (q == null || q == Null || q == CharNull) {
                                k.push(p.getRequiredException())
                            }
                        }
                    }
                    continue
                }
            }
            var u = p.mID;
            var h = null;
            if (s) {
                h = p.Validate()
            }
            if (b) {
                if (p.EqualsDefaultValue(h)) {
                    continue
                }
            }
            if (A) {
                y = !(((p.mLastChanged && getField_LastCleared_NS(f) <= p.mLastChanged) && (u in v)) || ((u in getForm_NS(f).displayOnlyFields) && !E.isNull))
            }
            if (s && h) {
                k.push(h);
                y = true
            }
            if (!y) {
                B.AddField(u, E)
            }
        }
    }
    if (k.length != 0) {
        getCurWFC_NS(f).status(k)
    }
    for (ii in getForm_NS(f).systemFields) {
        B.RemoveField(ii)
    }
    B.RemoveField(1100);
    return B
}
function Field_GetQBEFieldList(f) {
    var p = [];
    var o = {};
    o.fl = new FieldList(f);
    o.ps = null;
    var h = getFields_NS(f);
    for (var g in h) {
        try {
            var q = h[g];
            if (q.mID >= 1000000 && q.mID <= 1999999) {
                continue
            }
            if (q.mHaveStoredData) {
                var b = q.mID;
                var d;
                if (q instanceof DataField) {
                    d = q.GetScreenValue().trim(1 | 2);
                    if (d.match(SavedSearches.QBEPSP)) {
                        d = d.substring(1, d.length - 1);
                        if (!ARKWIsKeywordOrEscapedKeyword(f, d)) {
                            if (o.ps == null) {
                                o.ps = new Object()
                            }
                            o.ps[b] = d;
                            continue
                        }
                    }
                }
                d = q.GetQBEValue();
                if (d instanceof CharType) {
                    d = ARFuncRTrim(d)
                }
                if (!d.isNull || d == NullType.KEYWORD_NULL) {
                    o.fl.AddField(b, d)
                }
            }
        } catch(k) {
            p.push(k)
        }
    }
    if (p.length != 0) {
        getCurWFC_NS(f).status(p)
    }
    return o
}
function Field_QueryLoadEntry(d, h, b, k) {
    var g = new NDXGetEntry(d, ARKWGetStringByIdx(d, 7), ARKWGetStringByIdx(d, 6), ((ARKWGetStringByIdx(d, 21) != null) ? ARKWGetStringByIdx(d, 21) : ""), window.name, h, [], true);
    var f = g.result;
    if (f instanceof Array) {
        Field_LoadEntry(d, f, b, k, h)
    }
}
function Field_LoadEntry(o, w, y, b, g) {
    DDiary.SetDiaryFieldsDeferred(o, ARKWGetStringByIdx(o, 7), ARKWGetStringByIdx(o, 6), g);
    if (w instanceof Array) {
        var d = !y,
        k = null,
        h = {},
        A = w.length,
        p = {},
        v = 0;
        for (var q in w) {
            var B = w[q];
            if ("ts" in B) {
                v = B.ts
            } else {
                h[B.i] = B
            }
        }
        var s = getFields_NS(o);
        for (var q in s) {
            var u = s[q];
            if (q in h) {
                h[q].a = {
                    p: u
                };
                k = Datatype_Factory(h[q]);
                u.SLoadEntry(k)
            } else {
                k = Null;
                if (getViewFields_NS(o)[q]) {
                    u.DataDefault();
                    u.ClearInlineFormSettings()
                } else {
                    if (b && u.mHaveStoredData) {
                        if (u.mDeferred) {
                            if (u.mCharEditBox && u instanceof DDiary) {
                                u.GetHistory()
                            }
                        } else {
                            u.Clear()
                        }
                    }
                }
            }
            if (d && u.mHaveStoredData) {
                p[q] = {
                    d: k
                }
            }
            u.mCursorRange = null
        }
        setDBSnapshot_NS(o, new FieldSnapshot(o));
        getDBSnapshot_NS(o).d = true;
        getDBSnapshot_NS(o).mSnap = p;
        getDBSnapshot_NS(o).ts = v
    }
    Field_ClearChanged(o)
}
Field.prototype.Snapshot = function(d, b) {
    var f = {};
    if (d) {
        f.d = this.G()
    }
    if (this.mHaveVisualCharacteristics && b) {
        f.a = this.mCFCache.a;
        f.l = this.mCFCache.l;
        f.c = this.mCFCache.c;
        f.f = this.mCFCache.f;
        f.v = this.mCFCache.v;
        f.m = this.mCFCache.m
    }
    return f
};
Field.prototype.Restore = function(b, f, d) {
    if (f) {
        this.S(b.d)
    }
    if (this.mHaveVisualCharacteristics && d) {
        this.SAccess(b.a);
        this.SLabel(b.l);
        this.SColour(b.c);
        this.SFont(b.f);
        this.SVis(b.v);
        this.SMenu(b.m);
        if (typeof this.mCFCache.r != "undefined" && (this.mCFCache.r != 3)) {
            this.clearDec()
        }
    }
};
Field.prototype.mIsComplexField = false;
function Field_Clear(d, g) {
    var b = (g) ? 1020 : 0;
    var h = getFields_NS(d);
    for (var f in h) {
        if (f == b) {
            continue
        }
        h[f].Clear()
    }
}
function Field_SetROBackground(b, h) {
    setARFieldROBg_NS(b, h);
    var f = getFields_NS(b);
    for (var d in f) {
        var g = f[d];
        if (g.mDOMField && g.GAccess() == 1) {
            g.UpdateROColour()
        }
    }
}
Field.prototype.UpdateROColour = function() {};
function Field_GetChanged(b) {
    return getFieldChanged_NS(b)
}
function Field_ClearChanged(b) {
    setFieldChanged_NS(b, 0);
    setField_LastCleared_NS(b, getField_LastCleared_NS(b) + 1);
    DControl_DirtyFlagChanged(b, 0)
}
function Field_ClearChangedFromRunProcess(b) {
    setFieldChanged_NS(b, 0);
    DControl_DirtyFlagChanged(b, 0)
}
function Field_SetChanged(b) {
    if (getFieldChanged_NS(b) != 1) {
        setFieldChanged_NS(b, 1);
        DControl_DirtyFlagChanged(b, 1)
    }
}
Field.prototype.SetDirty = function() {
    this.mLastChanged = getField_LastCleared_NS(this.windowID);
    if (getFieldChanged_NS(this.windowID) == 1 || (this.mDCF)) {
        return
    }
    DControl_DirtyFlagChanged(this.windowID, 1);
    setFieldChanged_NS(this.windowID, 1)
};
Field.prototype.IsDirty = function() {
    return getFieldChanged_NS(this.windowID) > 0 && this.mLastChanged && getField_LastCleared_NS(this.windowID) <= this.mLastChanged
};
function Field_Defaults(b, k, d, h) {
    var o = getDefaults_NS(b);
    for (var f in o) {
        var p = getFields_NS(b)[f];
        if (p == null) {
            continue
        }
        if (k) {
            p.DataDefault()
        }
        if (d && p.mHaveVisualCharacteristics) {
            var g = o[f];
            p.SColour("c" in g ? g.c: null);
            p.SFont("f" in g ? g.f: "f1");
            if ("l" in g) {
                p.SLabel(g.l)
            }
            if ("m" in g) {
                p.SMenu(g.m)
            }
            if ("v" in g) {
                p.SVis(g.v)
            }
            if ("a" in g) {
                p.SAccess(h ? 1 : g.a)
            }
            if (typeof p.mCFCache.r != "undefined" && p.mCFCache.r != 3) {
                p.clearDec()
            }
        }
    }
}
function Field_ExpandDefaultValues(b) {
    var g = getDefaults_NS(b);
    for (var d in g) {
        var f = g[d];
        if ("d" in f) {
            if (typeof f.d == "string") {
                f.d = ExpandString(b, f.d, 16)
            }
        }
    }
}
var DummyField = null;
function F(b, d) {
    if (arguments.length == 1) {
        d = arguments[0];
        b = getCurrentWindowID_NS()
    }
    return (d in getFields_NS(b)) ? getFields_NS(b)[d] : DummyField
}
function Field_FindByDBN(b, h) {
    var f = getFields_NS(b);
    for (var d in f) {
        var g = f[d];
        if (g.mDOMField) {
            if (g.mObj.getAttribute("ardbn") == h) {
                return g
            }
        } else {
            if (g.mObj.dbn == h) {
                return g
            }
        }
    }
    return null
}
function Field_FindByLabel(b, d) {
    var g = getFields_NS(b);
    for (var f in g) {
        var h = g[f];
        if (h.mHaveVisualCharacteristics && h.GLabel() == d) {
            return h
        }
    }
    return null
}
function SetFieldFromDialog(d, b, f) {
    if (b in getFields_NS(d)) {
        var g = {};
        weDeepCopy(g, f);
        getFields_NS(d)[b].S(Datatype_Factory(f))
    }
}
Field.prototype.GetParent = function() {
    if (! ("parent" in this)) {
        var f = this.mObj.parentNode;
        var b = getBody();
        var d;
        this.parent = null;
        while (f && f != b) {
            if (f.getAttribute("arstop") == "1") {
                break
            }
            if (f.nodeType == 1 && (d = f.getAttribute("arid"))) {
                this.parent = getFields_NS(this.windowID)[parseInt(d)];
                break
            } else {
                f = f.parentNode
            }
        }
    }
    return this.parent
};
Field.prototype.GetNestedFocusability = function() {
    var b = this.GetParent();
    return ((this.mDOMField) && (this.GAccess() != 3) && this.GVis() && (b == null || b.GetNestedFocusability()))
};
Field.prototype.GetFocusElement = function() {
    return null
};
Field.prototype.GetSorter = function() {
    return "lhs.localeCompare(rhs)"
};
Field.prototype.EqualsDefaultValue = function(h) {
    if (h != null) {
        return false
    }
    var p = this.G();
    var k = this.GDefault();
    var f = (k != null && p.EQ(k));
    if (f) {
        var g = {
            35 : 1,
            34 : 1,
            17 : 1
        };
        if ((typeof this.mID != "undefined") && ("d" in getDefaults_NS(this.windowID)[this.mID])) {
            var o = "" + getDefaults_NS(this.windowID)[this.mID].d;
            if (ARKWIsKeywordString(this.windowID, o)) {
                var d = o.substring(1, o.length - 1);
                var b = getARKWNameLookup_NS(this.windowID)[d];
                return ((typeof g[b] != "undefined") ? false: true)
            } else {
                return true
            }
        } else {
            return true
        }
    } else {
        return false
    }
};
Field.prototype.GetType = function() {};
Field.prototype.GetScreenValue = function() {
    return this.G().toString()
};
Field.prototype.IsVisible = function() {
    return true
};
Field.prototype.GetHoverValue = function(b) {
    return ""
};
Field.prototype.Unload = function() {};
Field.prototype.resetFocusTab = function(b) {};
Field.prototype.getRequiredException = function() {
    var b = {
        cId: 1,
        t: 2,
        n: 9424,
        a: ""
    };
    b.m = getLocalizedMessage("Required field (without a default) not specified");
    b.a = (this.mID).toString();
    return b
};
Field.prototype.SetRTFVal = function(o) {
    try {
        if (this.mRTF) {
            if (o.length > 0) {
                o = this.VerifyImageURL(o)
            }
            var k = this.GetIFrameDoc();
            if (k) {
                var b = this;
                if (this.mAutoSizeHeight || this.mAutoSizeWidth) {
                    var f = YAHOO.util.Dom,
                    d = this.mIFrame;
                    if (this.mAutoSizeHeight) {
                        f.setStyle(this.mInputNode.parentNode, "height", this.mMinHeight + "px");
                        f.setStyle(this.mInputNode, "height", this.mMinHeight + "px")
                    }
                    if (this.mAutoSizeWidth) {
                        f.setStyle(this.mInputNode.parentNode, "width", this.mMinWidth + "px");
                        f.setStyle(this.mInputNode, "width", this.mMinWidth + "px")
                    }
                    f.setStyle(d, "width", "99%");
                    f.setStyle(d, "zoom", "1");
                    f.setStyle(d, "cursor", "default");
                    var h = function() {
                        window.setTimeout(function() {
                            if (b.mAutoSizeHeight) {
                                b.AutoHeightRTF()
                            }
                            if (b.mAutoSizeWidth) {
                                b.AutoWidthRTF()
                            }
                        },
                        100)
                    };
                    window.setTimeout(function() {
                        h()
                    },
                    100)
                }
                k.body.innerHTML = o
            }
            this.mRTFVal = o
        }
    } catch(g) {}
};
Field.prototype.GetRTFVal = function() {
    if (this.mRTF) {
        var d = this.mInputNode.firstChild;
        if (d == null || typeof d == "undefined") {
            return ""
        }
        var b = d.data;
        if (typeof b != "undefined" && b != null) {
            return b
        } else {
            var g = this.GetIFrameDoc();
            if (g) {
                try {
                    return g.body.innerHTML
                } catch(f) {
                    if (typeof this.mRTFVal != "undefined" && this.mRTFVal) {
                        return this.mRTFVal
                    }
                }
            } else {
                if (typeof this.mRTFVal != "undefined" && this.mRTFVal) {
                    return this.mRTFVal
                } else {
                    if (d.tagName != "IFRAME") {
                        return d.innerHTML
                    }
                }
            }
        }
    }
    return ""
};
Field.prototype.GetIFrameDoc = function() {
    if (this.mIFrame == null) {
        return null
    }
    return DocView.GetIFrameDoc(this.mIFrame, this.mIFrame.name)
};
Field.prototype.InitInputNode = function() {
    if (! (this.mRTF)) {
        return
    }
    var d = YAHOO.util.Dom,
    w = YAHOO.util.Event,
    h = YAHOO.lang;
    if (this.mInputNode.hasChildNodes()) {
        try {
            var u = this.mIFrame;
            var v = this.GetIFrameDoc();
            if (v != null) {
                w.removeListener(v, "click")
            }
            if (u != null) {
                u.src = ""
            }
        } catch(p) {}
        this.mInputNode.innerHTML = ""
    }
    var k = this.mInputNode.className.indexOf(" sr ") >= 0;
    var b = this.CreateIFrame(this.mInputNode.getAttribute("title"), k);
    this.mInputNode.appendChild(b);
    this.mIFrame = b;
    if (b == null) {
        return
    }
    this.mInputNode.style.overflow = (k ? "hidden": "visible");
    b.style.width = (k ? "1000%": "100%");
    var o = '<html dir="{DIRECTION}"><head><title>{TITLE}</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><base href=""><style>{CSS}</style><style>{HIDDEN_CSS}</style><style>{EXTRA_CSS}</style></head><body onload="document.body._rteLoaded = true;">{CONTENT}</body></html>';
    var s = "ltr";
    var f = "html { height: 100%; width: 100% } body { padding: 0px; background-color:" + ((this.GAccess() == 1) ? "#D4D9DE": "#fff") + "; font:11px/1.03 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;cursor:default;" + (this.mInputNode.className.indexOf("dat") != -1 ? "background:inherit;}": "}");
    var q = "";
    var g = "";
    o = h.substitute(o, {
        DIRECTION: s,
        TITLE: "",
        CONTENT: "",
        CSS: f,
        HIDDEN_CSS: q,
        EXTRA_CSS: g
    });
    var y = this;
    var v = y.GetIFrameDoc();
    if (v != null && typeof v != "undefined") {
        v.open();
        v.write(o);
        v.close();
        w.on(v, "click",
        function(A) {
            var B = w.getTarget(A);
            if (B.tagName == "A" || (B.parentNode != null && B.parentNode.tagName == "A")) {
                return true
            }
            y.FireDOCOnClick(A);
            return true
        },
        y, true)
    }
};
var curClickElement = null;
Field.prototype.FireDOCOnClick = function(b) {
    if (this.mInputNode != null && this.mRTF) {
        FormEvent.FireClickEventFromSRCElement(document.body, this.mInputNode, b)
    }
};
Field.prototype.CreateIFrameText = function(f, b) {
    var g = "ltr";
    var h = "iframe_" + this.mID;
    var d = "javascript:;";
    return "<iframe name=" + h + " id=" + h + ' title="' + f + '" scrolling=' + (b ? "no": "auto") + " dir=" + g + " border=0 marginWidth=0 marginHeight=0 src=" + d + ' frameBorder=0 width="100%" height="100%" allowTransparency rightMargin="3px" leftMargin="2px" topMargin="3px" bottomMargin="0px" display="none" visibility="visible"></iframe>'
};
Field.prototype.CreateIFrame = function(g, p) {
    var k = YAHOO.util.Dom,
    u = YAHOO.util.Event,
    o = YAHOO.lang;
    var s = "ltr";
    var f = "iframe_" + this.mID;
    var d = document.createElement("iframe");
    d.id = f;
    var b = {
        name: f,
        scrolling: (p ? "no": "auto"),
        title: g,
        dir: s,
        border: "0",
        frameBorder: "0",
        marginWidth: "0",
        marginHeight: "0",
        rightMargin: "3px",
        leftMargin: "2px",
        topMargin: "3px",
        bottomMargin: "0px",
        allowTransparency: "true",
        width: "100%",
        height: "100%",
        display: "none",
        visibility: "visible",
        cursor: "default"
    };
    for (var h in b) {
        if (o.hasOwnProperty(b, h) && b[h]) {
            d.setAttribute(h, b[h])
        }
    }
    var q = "javascript:;";
    d.setAttribute("src", q);
    return d
};
Field.prototype.VerifyImageURL = function(f) {
    if (f && typeof f == "string" && f.length > 0 && f.indexOf(" arattid=") > 0) {
        var d = getFields_NS(this.windowID)[1];
        entryIDVal = null;
        if (d) {
            if (d.mPrimVal && d.mPrimVal.length > 0) {
                entryIDVal = d.mPrimVal
            } else {
                if (d.mObj && d.mObj.v && d.mObj.v.mValue) {
                    entryIDVal = d.mObj.v.mValue
                }
            }
            if (entryIDVal && entryIDVal.length > 0) {
                if (typeof this.mRTFJoinIndex != "undefined" && this.mRTFJoinIndex >= 0) {
                    var b = entryIDVal.split("|");
                    if (b && b.length > this.mRTFJoinIndex) {
                        entryIDVal = b[this.mRTFJoinIndex]
                    }
                }
                f = updateRtfHtml(this.windowID, f, entryIDVal);
                this.mDataVal = dt = this.ConvertPrimitiveToDataType(f);
                dtstr = dt.toString()
            }
        }
    }
    return f
};
Field.prototype.AutoHeightRTF = function() {
    if (!this.mRTF || this.mIFrame == null) {
        return
    }
    var f = YAHOO.util.Dom,
    o = YAHOO.util.Event,
    g = YAHOO.lang;
    var k = this.GetIFrameDoc(),
    h = k.body,
    d = this.mIFrame;
    var p = parseInt(f.getStyle(this.mInputNode, "height"), 10);
    var b = p;
    b = k.documentElement.scrollHeight;
    b += 10;
    if (b < this.mMinHeight) {
        b = this.mMinHeight
    }
    if (this.mMaxHeight > 0 && b > this.mMaxHeight) {
        b = this.mMaxHeight
    }
    if (p != b) {
        f.setStyle(this.mInputNode.parentNode, "height", b + "px");
        f.setStyle(this.mInputNode, "height", b + "px");
        f.setStyle(d, "height", "99%");
        f.setStyle(d, "zoom", "1");
        var q = this;
        window.setTimeout(function() {
            f.setStyle(d, "height", "100%")
        },
        1)
    }
    if (rtfEditor != null && rtfEditor.mEditing != null) {
        rtfEditor.UpdatePos()
    }
};
Field.prototype.AutoWidthRTF = function() {
    if (!this.mRTF || this.mIFrame == null) {
        return
    }
    var g = YAHOO.util.Dom,
    p = YAHOO.util.Event,
    h = YAHOO.lang;
    var o = this.GetIFrameDoc(),
    k = o.body,
    d = this.mIFrame;
    var b = parseInt(g.getStyle(this.mInputNode, "width"), 10);
    var f = b;
    f = o.documentElement.scrollWidth;
    f += 10;
    if (f < this.mMinWidth) {
        f = this.mMinWidth
    }
    if (this.mMaxWidth > 0 && f > this.mMaxWidth) {
        f = this.mMaxWidth
    }
    if (b != f) {
        g.setStyle(this.mInputNode.parentNode, "width", f + "px");
        g.setStyle(this.mInputNode, "width", f + "px");
        g.setStyle(d, "width", "99%");
        g.setStyle(d, "zoom", "1");
        var q = this;
        window.setTimeout(function() {
            g.setStyle(d, "width", "100%")
        },
        1)
    }
};
Field.prototype.SetDisabled = function(b) {
    if (! (this instanceof DPage || this instanceof DPageHolder)) {
        return
    }
    if (this.mDisabled == b) {
        return
    }
    if (this.mDisabledObj == null) {
        var d = document.createElement("DIV");
        d.style.top = "0px";
        d.style.left = "0px";
        d.style.width = "100%";
        d.style.height = "100%";
        d.style.backgroundColor = "black";
        d.style.opacity = ".20";
        d.style.visibility = "hidden";
        d.style.zIndex = 0;
        this.mDisabledObj = d;
        this.mObj.appendChild(d)
    }
    this.mDisabledObj.style.visibility = (b == true) ? "visible": "hidden";
    this.mDisabledObj.style.zIndex = (b == true) ? nextZIndex++:0;
    this.mDisabled = b
};
function GetFieldLabelColor(b, d) {
    var f = F(b, d);
    if (f) {
        return f.GColour()
    }
    return null
}
function GetFieldFont(b, d) {
    var f = F(b, d);
    if (f) {
        return f.GFont()
    }
    return null
}
function GetFieldBGColor(b, d) {
    var f = F(b, d);
    return (f) ? f.mObj.style.backgroundColor: null
}
var rtfEditor = null;
var rtfCreated = false;
RTF_Close = function(b) {
    if (rtfEditor && rtfEditor.IsVisible()) {
        rtfEditor.Close(b)
    }
};
function Field_Init(b, o, k) {
    if (!o) {
        o = getBody(b)
    }
    var h = o;
    if (typeof k == "undefined") {
        k = false
    }
    while (1) {
        var g, d = true;
        if (h.nodeType == 1 && (g = h.getAttribute("arid")) && (h != o || k == true)) {
            if (g.indexOf("app") != -1) {
                var f = DOMFieldFactories[h.getAttribute("artype")](b, g, h)
            } else {
                var f = DOMFieldFactories[h.getAttribute("artype")](b, parseInt(g), h)
            }
            if (f.mID != 1020 && typeof getFieldListInfo_NS(b).firstField == "undefined") {
                getFieldListInfo_NS(b).firstField = f
            }
            getFieldListInfo_NS(b).lastField = f;
            d = f.mContainFields
        }
        if (h.firstChild && d) {
            h = h.firstChild
        } else {
            while (!h.nextSibling) {
                h = h.parentNode;
                if (h == o) {
                    return
                }
            }
            h = h.nextSibling
        }
    }
}
Field.prototype.mTextElement = null;
Field.prototype.TrackCaret = function(f) {
    if ("selection" in document && "createRange" in document.selection) {
        if (!f || f.nodeType != 1) {
            return
        }
        var d = f.tagName;
        if (! (d == "TEXTAREA" || (d == "INPUT" && f.type.toUpperCase() == "TEXT"))) {
            return
        }
        try {
            var b = document.selection.createRange().duplicate();
            if (b.parentElement() != f) {
                return
            }
            this.mCursorRange = b
        } catch(g) {}
    }
};
Field.prototype.InsertAtCaret = function(d, f) {
    if ("setSelectionRange" in d) {
        var g = d.selectionStart,
        b = d.selectionEnd;
        d.value = d.value.substr(0, g) + f + d.value.substr(b);
        d.setSelectionRange(g + f.length, g + f.length)
    } else {
        if (this.mCursorRange) {
            this.mCursorRange.text = f;
            this.mCursorRange.select()
        } else {
            d.value += f
        }
    }
    d.focus()
};
Field.prototype.ResizeTo = function(d, b) {
    if (this.mObj.style.width != this.perWidth + "%") {
        this.mObj.style.width = this.perWidth + "%"
    }
    if (this.mObj.style.height != this.perHeight + "%") {
        this.mObj.style.height = this.perHeight + "%"
    }
};
Field.prototype.UpdateLabel = function(h) {
    var k = this.mTextElement;
    if (k) {
        var g = k.firstChild;
        while (g != null && g.nodeType != 3) {
            g = g.nextSibling
        }
        if (g) {
            k.removeChild(g)
        }
        k.appendChild(document.createTextNode(h))
    } else {
        var d = this.mObj;
        if (d.children && d.children[0] != null && d.children[0].nodeType == 1 && d.children[0].className.indexOf("btnimgdiv") != -1) {
            var f = d.children[0].children[0];
            if (Boolean(parseInt(f.getAttribute("aralttxt"))) == false) {
                f.setAttribute("artxt", h)
            }
            var b = (d.className.indexOf("btnd") != -1 || d.className.indexOf("btndflt") != -1) ? true: false;
            FakeButton_SetAlternative(this.mObj, b)
        }
    }
};
Field.prototype.UpdateColour = function(b) {
    var d = this.mTextElement;
    if (!d) {
        return
    }
    if (b == null) {
        if ("c" in getDefaults_NS(this.windowID)[this.mID]) {
            b = getDefaults_NS(this.windowID)[this.mID].c
        } else {
            b = ""
        }
    }
    d.style.color = b
};
Field.prototype.UpdateFont = function(f) {
    var g = this.mTextElement;
    if (!g) {
        return
    }
    var d = g.className.split(" ");
    for (var b in d) {
        if (d[b].match(/f[0-9]+$/)) {
            d[b] = f;
            g.className = d.join(" ");
            return
        }
    }
    d.push(f);
    g.className = d.join(" ")
};
Field.prototype.TabableElementSelector = function(b) {
    if (b.tagName == "A" || b.tagName == "INPUT" || b.tagName == "TEXTAREA") {
        if (!b.style || b.style.visibility != "hidden") {
            return b
        }
    }
    return null
};
Field.prototype.GetFocusElementForEvent = function(d) {
    if (this.GetNestedFocusability()) {
        var f = d.element;
        var b = this.mObj;
        while (f != null) {
            var g = this.TabableElementSelector(f);
            if (g) {
                return g
            }
            if (f == b) {
                break
            }
            f = f.parentNode
        }
    }
    return null
};
Field.prototype.IsLabelPart = function(b) {
    return (b && b.className.indexOf("label") != -1)
};
Field.prototype.LocInLabel = function(b) {
    if (b) {
        if (b.element.className.indexOf("label") != -1) {
            return true
        }
        if (b.element.tagName == "SPAN") {
            return true
        }
        var f = this.mObj.getAttribute("arlbox");
        if (b.element.className.indexOf("arfid") != -1) {
            if (f) {
                var g = f.split(",");
                for (var d = 0; d < g.length; d++) {
                    g[d] = parseInt(g[d])
                }
                if (b.ox >= g[0] && b.ox <= g[2] && b.oy >= g[1] && b.oy <= g[3]) {
                    return true
                }
            }
        }
    }
    return false
};
Field.prototype.UpdateVis = function(b) {
    if (!this.mHaveVisualCharacteristics) {
        return
    }
    this.mObj.style.visibility = (b ? "inherit": "hidden")
};
Field.prototype.UpdateDraggable = function(b) {
    if (!this.mHaveVisualCharacteristics) {
        return
    }
    MidTierDragDropMgrInst.setDragSourceEnabled(this.mObj, b)
};
Field.prototype.UpdateDroppable = function(b) {
    if (!this.mHaveVisualCharacteristics) {
        return
    }
    MidTierDragDropMgrInst.setDropTargetEnabled(this.mObj, b)
};
Field.prototype.RegisterLayoutField = function(f, d) {
    var b = this.mObj.getAttribute("arfillstyle");
    if (this.mFillModel == null && b != "0") {
        this.mFillModel = new FillLayoutPolicy()
    }
    if (this.mFillModel != null) {
        this.mFillModel.RegisterLayoutField(f, d)
    }
};
Field.prototype.DeRegisterLayoutField = function(b) {
    if (this.mFillModel == null) {
        return
    }
    this.mFillModel.DeRegisterLayoutField(b)
};
Field.prototype.DOMFocus = function(b) {
    if (rtfEditor != null && rtfEditor.mEditing != null && rtfEditor.mEditing != b.element) {
        RTF_Close(true)
    }
    var d = [];
    var f = this.windowID;
    d.push({
        f: function() {
            if (hoverState) {
                return hoverState.clearFocusEvent(f)
            }
        }
    });
    d.push({
        f: ExecuteWorkflow,
        a: [f, 8192, this.mID]
    });
    d.push({
        f: function() {
            if (hoverState) {
                hoverState.focusEvent(hoverState.GAIN)
            }
        }
    });
    if (getCurWFC_NS(this.windowID)) {
        return getCurWFC_NS(this.windowID).execute(d)
    } else {
        new WorkflowContext(this.windowID, d)
    }
};
Field.prototype.DOMBlur = function(b) {
    var d = [];
    var f = this.windowID;
    d.push({
        f: function() {
            if (hoverState) {
                return hoverState.clearFocusEvent(f)
            }
        }
    });
    d.push({
        f: ExecuteWorkflow,
        a: [f, 256, this.mID]
    });
    d.push({
        f: function() {
            if (hoverState) {
                hoverState.focusEvent(hoverState.LOSE)
            }
        }
    });
    if (getCurWFC_NS(this.windowID)) {
        return getCurWFC_NS(this.windowID).execute(d)
    } else {
        new WorkflowContext(this.windowID, d)
    }
};
Field.prototype.DOMClick = Field.prototype.DOMKeyPress = function(b) {
    if (rtfEditor != null && rtfEditor.mEditing != null && rtfEditor.mEditing != evt.element) {
        RTF_Close(true)
    }
};
Field.prototype.DOMContextMenu = function(b) {};
Field.prototype.DOMMouseUp = Field.prototype.DOMMouseDown = Field.prototype.DOMMouseOver = Field.prototype.DOMMouseMove = Field.prototype.DOMMouseOut = Field.prototype.DOMKeyDown = Field.prototype.DOMDoubleClick = Field.prototype.DOMKeyUp = Field.prototype.DOMDragStart = function(b) {};
Field.prototype.ShowRTF = function(f) {
    if (f.className.indexOf("dat") != -1) {
        return
    }
    if (rtfEditor == null) {
        var b = [];
        var h = null;
        var g = this;
        var d = f;
        b.push({
            f: function() {
                if (ShowWaitCursor()) {
                    h = new NDXRequest();
                    h.showRunning();
                    weDisableStuff(g.windowID)
                }
                return {}
            },
            t: this
        });
        b.push({
            f: function() {
                rtfEditor = new RichTextEditor(g.windowID, "rtf_editor");
                rtfEditor.CreateRTFWidget(f);
                var k = rtfEditor.GetEditor();
                if (k != null) {
                    k.on("editorContentLoaded",
                    function() {
                        k.unsubscribeAll("editorContentLoaded");
                        setTimeout(function() {
                            rtfEditor.Show(d, g);
                            rtfCreated = true;
                            if (h) {
                                h.hideRunning();
                                weEnableStuff(g.windowID)
                            }
                            rtfEditor.Focus()
                        },
                        5)
                    },
                    k, true)
                }
                return {}
            },
            t: this
        });
        new WorkflowContext(this.windowID, b)
    } else {
        if (rtfCreated) {
            if (rtfEditor.mEditing != f) {
                this.HideRTF(true);
                rtfEditor.Show(f, this)
            } else {
                rtfEditor.Focus()
            }
        }
    }
};
Field.prototype.HideRTF = function(b) {
    RTF_Close(b)
};
Field.prototype.IsDOMVisible = function() {
    var b = document.body;
    var d = this.mObj;
    while (d != b) {
        if (d.style.visibility == "hidden") {
            return false
        } else {
            if (d.style.visibility == "visible") {
                return true
            } else {
                d = d.parentNode
            }
        }
    }
    return true
};
Field.prototype.showTT = function() {
    this.mTT = this.mObj;
    this.mTT.onmouseout = null;
    this.mTT.style.visibility = "hidden";
    this.mTT.style.top = 0;
    this.mTT.style.left = 0;
    var g = hoverState.inEvtHover();
    var u = hoverState.inButtonClick();
    if (g && !hoverState.hasMouseTrackEvent()) {
        hoverState.reset();
        return null
    }
    var q = false;
    if (g) {
        q = true
    }
    if (u && hoverState.buttonActivatedByKey() == false) {
        q = true
    }
    if (g || u) {
        var h;
        if (g) {
            h = hoverState.getHoverField()
        } else {
            if (u) {
                h = hoverState.getClickField()
            }
        }
        var b = h.GetParent();
        while (b) {
            if (b.mFloat == 3) {
                this.mParent = b;
                if (b.mChild != null) {
                    b.mChild.reset()
                }
                b.mChild = this
            }
            b = b.GetParent()
        }
        if (this.mParent == null) {
            if (this.mID != formTTList.mPrimary.mID) {
                while (formTTList.mPrimary) {
                    formTTList.mPrimary.reset();
                    formTTList.mPrimary = formTTList.mPrimary.mChild
                }
                formTTList.mPrimary = this
            }
        }
    }
    this.mDisplay = true;
    var s = this;
    var d = this.mTT;
    var w = hoverState.getTipLocation(d, q);
    var v = w.pos;
    var o = w.tipDims;
    d.style.left = v.x + "px";
    d.style.top = v.y + "px";
    d.style.visibility = "visible";
    d.style.zIndex = nextZIndex++;
    try {
        this.mTT.focus()
    } catch(k) {}
};
Field.prototype.reset = function() {
    this.mDisplay = false;
    this.mTT = this.mObj;
    this.mTT.onmouseout = null;
    this.mTT.style.visibility = "hidden";
    this.mTT.style.top = 0;
    this.mTT.style.left = 0
};
Field.prototype.EvtInside = function(f) {
    var o = f.mMouseX;
    var k = f.mMouseY;
    this.mTT = this.mObj;
    var h = this.mTT.style.left;
    var d = this.mTT.style.top;
    var b = -1;
    b = h.indexOf("px");
    if (b != -1) {
        h = h.substring(0, b)
    }
    b = d.indexOf("px");
    if (b != -1) {
        d = d.substring(0, b)
    }
    h = parseInt(h);
    d = parseInt(d);
    var g = h + this.mTT.clientWidth;
    var p = d + this.mTT.clientHeight;
    if (o > (h + 1) && o <= g && k > (d + 1) && k <= p) {
        return true
    } else {
        return false
    }
};
Field.prototype.getNoDragDropStyleClasses = function() {
    return null
};
Field.prototype.getDragHandlePrefixes = function() {
    return null
};
Field.prototype.setDecorator = function(d, b) {};
Field.prototype.setBoldness = function(b) {};
Field.prototype.clearDec = function() {};
function SetFieldFromDialog(d, b, f) {
    if (b in getFields_NS(d)) {
        var g = {};
        weDeepCopy(g, f);
        getFields_NS(d)[b].S(Datatype_Factory(f))
    }
}
function FieldSnapshot(windowID, d, a, hsd) {
    this.windowID = windowID;
    if (arguments.length == 2) {
        eval(d)
    } else {
        this.mSnap = {};
        if (arguments.length > 2) {
            this.d = d;
            this.a = a;
            if (hsd) {
                for (var i in getFields_NS(windowID)) {
                    var fi = getFields_NS(windowID)[i];
                    if (fi.mHaveStoredData) {
                        this.mSnap[i] = fi.Snapshot(d, a)
                    }
                }
            } else {
                for (var i in getFields_NS(windowID)) {
                    this.mSnap[i] = getFields_NS(windowID)[i].Snapshot(d, a)
                }
            }
        }
    }
}
FieldSnapshot.prototype.Restore = function() {
    for (var b in this.mSnap) {
        getFields_NS(this.windowID)[b].Restore(this.mSnap[b], this.d, this.a)
    }
};
FieldSnapshot.prototype.DataDiff = function(b) {
    var f = {};
    var d = b.mSnap;
    var h = this.mSnap;
    for (var g in getFields_NS(this.windowID)) {
        if (g in h) {
            if (h[g].d.Diff(d[g].d)) {
                f[g] = 1
            }
        }
    }
    return f
};
FieldSnapshot.prototype.GetDataForID = function(b) {
    if (this.mSnap[b]) {
        return this.mSnap[b].d
    } else {
        return Null
    }
};
function FieldList(b, g) {
    this.windowID = b;
    this.mFields = new Object();
    if (g instanceof Array) {
        for (var f = 0; f < g.length; ++f) {
            var h = g[f];
            if (h > 0) {
                var d = F(this.windowID, h).G();
                if (d instanceof CharNullType) {
                    d = new CharType(" ")
                }
                this.AddField(h, d)
            } else {
                this.AddField(h, ARKWGetByNegIdx(this.windowID, h))
            }
        }
    }
}
FieldList.prototype.F = function(b) {
    return (b in this.mFields) ? this.mFields[b] : Null
};
FieldList.prototype.AddField = function(d, b) {
    this.mFields[d] = b
};
FieldList.prototype.AddFields1 = function(b, g) {
    for (var d = 0; d < b.length && d < g.length; ++d) {
        var f = b[d];
        this.mFields[g[d]] = Datatype_Factory(f)
    }
};
FieldList.prototype.RemoveField = function(b) {
    delete this.mFields[b]
};
FieldList.prototype.ToArrays = function(d, b, g) {
    for (var h in this.mFields) {
        var f = this.mFields[h];
        d.push(parseInt(h));
        b.push(f.toPrimitive());
        g.push(f.type)
    }
};
FieldList.prototype.Query = function(f, g, p, q, b, d) {
    f = ExpandServerName(this.windowID, f);
    g = ExpandSchemaName(this.windowID, g);
    var o = IsExternQualOptimizable(this.windowID, p);
    p = ExpandQualifier(this.windowID, p, g, f, o);
    var u = new NDXGetEntryList(this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), ARKWGetStringByIdx(this.windowID, 17), f, g, ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), p.qual, p.fieldids, p.fieldvals, p.fieldtypes, p.fieldexterns, o, b, q, d);
    var s = u.result;
    ARKWSetLASTCOUNT(this.windowID, s.n);
    if ("mids" in s) {
        d = s.mids
    }
    if ("f" in s) {
        this.AddFields1(s.f, d)
    } else {
        if ("l" in s) {
            var h = {};
            return {
                n: {
                    f: function(v) {
                        if (! ("v" in h.result) || h.result.v == -1) {
                            getCurWFC_NS(v.windowID).status(0)
                        }
                        u = new NDXGetEntry(v.windowID, f, g, ((ARKWGetStringByIdx(v.windowID, 21) != null) ? ARKWGetStringByIdx(v.windowID, 21) : ""), window.name, s.l.r[h.result.v].i, d, false);
                        s = u.result;
                        if (s instanceof Array) {
                            v.AddFields1(s, d)
                        } else {
                            ARKWSetLASTCOUNT(v.windowID, 0);
                            if (b == 1) {
                                getCurWFC_NS(v.windowID).status(9278)
                            }
                        }
                    },
                    a: [this]
                },
                c: {
                    f: SelectionPopup,
                    a: [this.windowID, s, h]
                }
            }
        } else {
            if ((s.n == 0 && b == 2) || (s.n > 0 && q == 2)) {
                for (var k = 0; k < d.length; ++k) {
                    this.AddField(d[k], Null)
                }
            } else {
                if (s.n > 0) {
                    getCurWFC_NS(this.windowID).status(9277)
                } else {
                    getCurWFC_NS(this.windowID).status(9278)
                }
            }
        }
    }
};
FieldList.PopulateValueAndTypeArrays = function(b, g, k, d) {
    for (var f in g) {
        id = g[f];
        var h;
        if (id > 0) {
            h = F(b, id).G()
        } else {
            h = ARKWGetByNegIdx(b, id)
        }
        if (h instanceof CharNullType) {
            k.push("");
            d.push(4)
        } else {
            k.push(h.toPrimitive());
            d.push(h.type)
        }
    }
};
FieldList.prototype.SQLQuery = function(A, o, s, p, E, h, D) {
    var k = new Array();
    var v = new Array();
    FieldList.PopulateValueAndTypeArrays(this.windowID, E, k, v);
    var B = new Array();
    var f = new Array();
    FieldList.PopulateValueAndTypeArrays(this.windowID, h, B, f);
    var b = new NDXGetSQLEntryList(this.windowID, ARKWGetStringByIdx(this.windowID, 7), A, o, p, s, E, k, v, h, B, f, false);
    var G = b.result;
    if (typeof G == "object") {
        ARKWSetLASTCOUNT(this.windowID, G.n);
        var y = new Array();
        var C = G.l.r[0].d.length;
        for (var d = 1; d <= C; d++) {
            y.push(d)
        }
        if (G.n == 1) {
            this.AddFields1(G.l.r[0].d, y)
        } else {
            if (s == 1) {
                getCurWFC_NS(this.windowID).status(9277)
            }
            var u = [];
            var g = G.l.r[0].d.length;
            for (var q = 1; q <= g; q++) {
                u.push(getLocalizedMessage("Column " + q))
            }
            G.l.h = u;
            var w = {};
            return {
                c: {
                    f: SelectionPopup,
                    a: [this.windowID, G, w]
                },
                n: {
                    a: [this],
                    f: function(K) {
                        if (! ("v" in w.result) || w.result.v == -1) {
                            getCurWFC_NS(K.windowID).status(0)
                        }
                        var L = G.l.r[w.result.v];
                        var J = [];
                        var H = L.d.length;
                        for (var I = 0; I < H; ++I) {
                            J.push(L.d[I])
                        }
                        K.AddFields1(J, y)
                    }
                }
            }
        }
    } else {
        ARKWSetLASTCOUNT(this.windowID, G);
        if ((G == 0 && p == 2) || (G > 0 && s == 2)) {} else {
            if (G > 0) {
                getCurWFC_NS(this.windowID).status(9277)
            } else {
                getCurWFC_NS(this.windowID).status(9278)
            }
        }
    }
};
FieldList.prototype.Push = function(s, o, p, u, f, k, v) {
    var b = (v && (AREventFunction(this.windowID, 4096) || ARPrefsGetAsNumber(28515) == 1)) ? true: false;
    o = ExpandServerName(this.windowID, o);
    p = ExpandSchemaName(this.windowID, p);
    s = ExpandQualifier(this.windowID, s, p, o);
    var g = new Array();
    var h = new Array();
    var d = new Array();
    this.ToArrays(g, h, d);
    var q = new Array();
    this.DirtyTableData(q);
    if (ShowWaitCursor() && v) {
        var w = new NDXRequest();
        w.windowID = this.windowID;
        var y = {
            isFromFunctionSplit: 1,
            c: {
                t: this,
                f: function() {
                    w.AsyncBC("SetEntryList", this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), o, ((v) ? "": p), F(this.windowID, 1).G().toString(), s.qual, s.fieldids, s.fieldvals, s.fieldtypes, f, u, k, g, h, d, getForm_NS(this.windowID).reqIdStrField, b, q);
                    w.showRunning();
                    weDisableStuff(this.windowID);
                    return {
                        i: 1
                    }
                }
            },
            n: {
                t: this,
                f: this.PushP2,
                a: [w, v, f, u]
            }
        };
        return y
    } else {
        var w = new NDXSetEntryList(this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), o, ((v) ? "": p), F(this.windowID, 1).G().toString(), s.qual, s.fieldids, s.fieldvals, s.fieldtypes, f, u, k, g, h, d, (!v) ? 0 : getForm_NS(this.windowID).reqIdStrField, b, q);
        this.PushP2(w, v, f, u)
    }
};
FieldList.prototype.PushP2 = function(g, h, f, k) {
    var d = g.result;
    if (d instanceof Object) {
        if (!h) {
            ARKWSetLASTCOUNT(this.windowID, 0)
        }
        ARKWSetLASTID(this.windowID, d.id);
        var b = F(this.windowID, getForm_NS(this.windowID).reqIdStrField);
        if ((b.mDataType == 7 || b.mDataType == 12) && b.mPrimVal.length > 0) {
            getForm_NS(this.windowID).reqIdStr = b.mPrimVal
        } else {
            if (b.mDataType == 6 && b.mDataVal.mLabel) {
                getForm_NS(this.windowID).reqIdStr = b.mDataVal.mLabel
            } else {
                if (typeof d.reqStr != "undefined") {
                    getForm_NS(this.windowID).reqIdStr = d.reqStr
                }
            }
        }
        if (typeof d.e != "undefined") {
            getForm_NS(this.windowID).entry = d.e
        }
    } else {
        ARKWSetLASTCOUNT(this.windowID, d);
        if (d == 0 && f == 1) {
            getCurWFC_NS(this.windowID).status(9278)
        } else {
            if (d > 0 && k == 1) {
                getCurWFC_NS(this.windowID).status(9364)
            }
        }
    }
};
FieldList.prototype.PushEntry = function(h, o, p, s, k, b) {
    h = ExpandServerName(this.windowID, h);
    o = ExpandSchemaName(this.windowID, o);
    var f = new Array();
    var g = new Array();
    var d = new Array();
    this.ToArrays(f, g, d);
    var q = new Array();
    this.DirtyTableData(q);
    if (ShowWaitCursor()) {
        k.req = new NDXRequest();
        k.req.windowID = this.windowID;
        return {
            isFromFunctionSplit: 1,
            c: {
                t: this,
                f: function() {
                    k.req.AsyncBC("SetEntry", this.windowID, h, o, window.name, p, s, f, g, d, b, q);
                    k.req.showRunning();
                    weDisableStuff(this.windowID);
                    return {
                        i: 1
                    }
                }
            },
            n: {
                t: this,
                f: function() {
                    var v = k.req.result;
                    this.PushEntryP2(v, p.length);
                    return
                }
            }
        }
    } else {
        k.req = new NDXSetEntry(this.windowID, h, o, window.name, p, s, f, g, d, b, q);
        var u = k.req.result;
        this.PushEntryP2(u, p.length);
        return u
    }
};
FieldList.prototype.PushEntryP2 = function(b, d) {
    if (b.n == 1) {
        getForm_NS(this.windowID).entry = b.e;
        if ("eid" in b) {
            getForm_NS(this.windowID).reqIdStr = b.eid
        }
    }
};
FieldList.SetAllGlobals = function(b, g) {
    if (arguments.length == 1) {
        if (b == getTopWinWindowID_NS()) {
            g = true
        } else {
            g = false
        }
    }
    var o = getFormContext(b);
    if (typeof o == "undefined" || o == null) {
        return
    }
    var h = getFieldChanged_NS(b);
    var d = getForm_NS(b);
    for (var k in d.globalFields) {
        F(b, d.globalFields[k]).ReadGlobalData()
    }
    ARKWGetGlobalKeywords(b);
    if ((h == 0) && (getFieldChanged_NS(b) != 0)) {
        Field_ClearChanged(b)
    }
    if (g == true) {
        FieldList.SetAllLogicalChildrenGlobals(b, g)
    }
};
FieldList.SetAllLogicalChildrenGlobals = function(b, g) {
    var h = getLogicalChildWindowIDs(b);
    for (var d in h) {
        var f = h[d];
        if (f != b) {
            FieldList.SetAllGlobals(f, g)
        }
    }
};
FieldList.ClearAllGlobals = function() {
    deleteCookie("GF", "/");
    var b = getCookie("FC");
    if (b == "1" && flashAppInit == true) {
        removeGlobalFields()
    }
    deleteCookie("FC", "/")
};
FieldList.prototype.DirtyTableData = function(b) {};
DataField.prototype = new Field();
DataField.prototype.constructor = DataField;
DataField.superclass = Field.prototype;
function DataField(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DataField.prototype.mDOMField = DataField.prototype.mHaveVisualCharacteristics = true;
DataField.prototype.init = function(b, g, f) {
    this.mDataVal = (this.mDataType == 4) ? CharNull: Null;
    DataField.superclass.init.call(this, b, g, f);
    var d = this.mObj.childNodes[1];
    while (d.nodeType == 1 && (d.className && d.className.indexOf("label") == -1) || !d.className) {
        d = d.firstChild
    }
    this.mTextElement = d;
    if (this.mInputNode) {
        this.mInputNode.onchange = DataField.fvChanged
    }
};
var SACCESSRE = /([ ]*dfro)|([ ]*dfd)/;
DataField.fvChanged = FormEvent.Trampoline(function(b) {
    var d = Field_FromElement(b.element);
    if (d) {
        d.FieldValChanged()
    }
});
DataField.prototype.FieldValChanged = function() {
    var f = this.GetScreenValAsPrimitive();
    if (this.mPrimVal == f) {
        return
    }
    if (((this.mDataType == 4) || (this.mDataType == 5)) && (f.indexOf("\n") > -1)) {
        var d = false;
        try {
            var b = this.mObj.lastElementChild.className;
            d = ((b.indexOf("btn") > -1) && (b.indexOf("expand") > -1))
        } catch(g) {
            try {
                d = this.mObj.lastChild.childNodes.length > 0
            } catch(g) {}
        }
        if (!d) {
            f = f.split("\n").slice(0, this.mInputNode.rows).join("\n");
            this.mInputNode.value = f
        }
    }
    this.mPrimVal = f;
    if (f == "") {
        this.mDataVal = (this.mDataType == 4) ? CharNull: Null
    } else {
        var h = {
            hasKeyword: false,
            hasTemporalKeyword: false
        };
        f = ExpandString(this.windowID, f, 2 | 4, this.mID, this.mDataType, h);
        if (h.hasTemporalKeyword) {
            this.mDataVal = null
        } else {
            if (f == "") {
                if (h.hasKeyword) {
                    this.mDataVal = (this.mDataType == 4) ? CharNullType.KEYWORD_CHAR_NULL: NullType.KEYWORD_NULL
                } else {
                    this.mDataVal = (this.mDataType == 4) ? CharNull: Null
                }
            } else {
                this.mDataVal = this.ConvertPrimitiveToDataType(f)
            }
        }
    }
    if (! ("mDCF" in this)) {
        this.mDCF = (this.mObj.getAttribute("ardcf") != null)
    }
    DataField.superclass.SetDirty.call(this);
    this.SaveGlobalData()
};
DataField.prototype.G = function() {
    if (this.mDataVal == null || (this.mDataVal.mVal && typeof this.mDataVal.mVal == "string" && this.mRTF && this.mRTFAttachmentFieldID && this.mRTFAttachmentFieldID > 0)) {
        var b = this.GetScreenValAsPrimitive();
        b = ExpandString(this.windowID, b, 2 | 4, this.mID, this.mDataType);
        if (b == "") {
            return (this.mDataType == 4) ? CharNull: Null
        }
        b = this.VerifyImageURL(b);
        return this.ConvertPrimitiveToDataType(b)
    }
    return this.mDataVal
};
DataField.prototype.GetScreenValAsPrimitive = function() {
    if (this.mbShowURL) {
        return this.GetValue()
    } else {
        if (this.mRTF) {
            if (this.mInputNode.firstChild) {
                return this.GetRTFVal()
            } else {
                return ""
            }
        }
    }
    return this.mInputNode.value
};
DataField.prototype.SetScreenValue = function(b) {
    if (this.mbShowURL) {
        this.updateInnerHTML(b);
        this.mInputNode.value = this.innerText();
        if (this.mInputNode.value.length > 0) {
            this.mDivEditBox.style.visibility = "visible";
            this.mInputNode.style.visibility = "hidden"
        } else {
            this.mDivEditBox.style.visibility = "hidden";
            this.mInputNode.style.visibility = "visible"
        }
        this.mOrgValue = this.mInputNode.value
    } else {
        if (this.mRTF) {
            this.SetRTFVal(b)
        } else {
            this.mInputNode.value = b
        }
    }
    this.FieldValChanged()
};
DataField.prototype.GetScreenValue = function() {
    if (this.mbShowURL) {
        return this.GetValue()
    } else {
        if (this.mRTF) {
            return this.GetRTFVal()
        }
    }
    return this.mInputNode.value
};
DataField.prototype.ConvertPrimitiveToDataType = function(b) {};
DataField.prototype.Clear = function() {
    var b = this.mID;
    if ((b >= 1000000 && b <= 1999999) || (b >= 3000000 && b <= 3999999) || b == 1576 || b == 1575) {
        return
    }
    this.mDataVal = (this.mDataType == 4) ? CharNull: Null;
    this.mPrimVal = "";
    this.mOrgValue = "";
    if (this.mNeedSpecialSetToScreen) {
        this.SToScreen(this.mDataVal, this.mPrimVal)
    } else {
        if (this.mbShowURL) {
            this.SetValue("")
        } else {
            if (this.mRTF) {
                this.SetRTFVal("")
            } else {
                this.mInputNode.value = ""
            }
        }
    }
    if (this.mCharEditBox) {
        if (this.mbShowURL) {
            CharEditBoxPopup_UpdateText(this.mCharEditBox, this.mDivEditBox.innerHTML, true)
        } else {
            if (this.mRTF) {
                CharEditBoxPopup_UpdateText(this.mCharEditBox, this.GetRTFVal(), true)
            } else {
                CharEditBoxPopup_UpdateText(this.mCharEditBox, this.mPrimVal, false)
            }
        }
    }
};
DataField.prototype.DoSet = function(d) {
    var f;
    if (d.isNull) {
        this.mDataVal = (this.mDataType == 4) ? CharNull: Null;
        f = ""
    } else {
        d = this.ConvertDTForS(d);
        f = d.toString();
        if (f == "") {
            this.mDataVal = (this.mDataType == 4) ? CharNull: Null
        } else {
            if (d.type == 4) {
                var g = {
                    hasKeyword: false,
                    hasTemporalKeyword: false
                };
                var b = ExpandString(this.windowID, f, 2 | 4 | 8, this.mID, this.mDataType, g);
                if (g.hasTemporalKeyword) {
                    this.mDataVal = null
                } else {
                    if ((this.mDataType == 4) && !g.hasKeyword) {
                        this.mDataVal = d
                    } else {
                        if (b == "") {
                            this.mDataVal = (this.mDataType == 4) ? CharNull: Null;
                            f = ""
                        } else {
                            this.mDataVal = d = this.ConvertPrimitiveToDataType(b);
                            f = d.toString()
                        }
                    }
                }
            } else {
                this.mDataVal = d
            }
        }
    }
    this.mPrimVal = f;
    this.mOrgValue = f;
    if (this.mNeedSpecialSetToScreen) {
        return this.SToScreen(d, f)
    }
    if (this.mbShowURL) {
        this.SetValue(f)
    } else {
        if (this.mRTF) {
            this.SetRTFVal(f)
        } else {
            this.mInputNode.value = f
        }
    }
    if (typeof AnimMgr != "undefined") {
        AnimMgr.Highlight(this, this.mObj)
    }
    if (!this.mbShowURL && !this.mRTF) {
        this.mPrimVal = this.mInputNode.value
    }
    if (this.mCharEditBox) {
        if (this.mbShowURL) {
            CharEditBoxPopup_UpdateText(this.mCharEditBox, this.mDivEditBox.innerHTML, true)
        } else {
            if (this.mRTF) {
                CharEditBoxPopup_UpdateText(this.mCharEditBox, this.GetRTFVal(), true)
            } else {
                CharEditBoxPopup_UpdateText(this.mCharEditBox, this.mPrimVal, false)
            }
        }
    }
    this.SetDirty(this.mInputNode)
};
DataField.prototype.DoSLoadEntry = function(f) {
    var h;
    if (f.isNull) {
        this.mDataVal = (this.mDataType == 4) ? CharNull: Null;
        h = ""
    } else {
        f = this.ConvertDTForSLE(f);
        h = f.toString();
        if (h == "") {
            this.mDataVal = (this.mDataType == 4) ? CharNull: Null
        } else {
            if (f.type == 4) {
                var k = {
                    hasKeyword: false,
                    hasTemporalKeyword: false
                };
                var d = ExpandString(this.windowID, h, 2 | 4, this.mID, this.mDataType, k);
                if (k.hasTemporalKeyword) {
                    this.mDataVal = null
                } else {
                    d = this.VerifyImageURL(d);
                    if ((this.mDataType == 4) && !k.hasKeyword) {
                        this.mDataVal = f
                    } else {
                        if (d == "") {
                            this.mDataVal = (this.mDataType == 4) ? CharNull: Null;
                            h = ""
                        } else {
                            this.mDataVal = f = this.ConvertPrimitiveToDataType(d);
                            h = f.toString()
                        }
                    }
                }
            } else {
                this.mDataVal = f
            }
        }
    }
    this.mPrimVal = f.compareValStr();
    var b = h;
    if (this.mNeedSpecialSetToScreen) {
        this.SToScreen(f, h);
        if (this instanceof DGroup) {
            var g = Group_Validate(this.mID, b, false);
            if (g && g.v) {
                b = g.v
            }
        }
    } else {
        if (this.mbShowURL) {
            this.SetValue(h)
        } else {
            if (this.mRTF) {
                this.SetRTFVal(h)
            } else {
                this.mInputNode.value = h
            }
        }
        if (!this.mbShowURL && !this.mRTF) {
            this.mPrimVal = this.mInputNode.value
        }
        this.SetDirty(this.mInputNode)
    }
    if (this.mCharEditBox) {
        if (this.mbShowURL) {
            CharEditBoxPopup_UpdateText(this.mCharEditBox, this.mDivEditBox.innerHTML, true)
        } else {
            if (this.mRTF) {
                CharEditBoxPopup_UpdateText(this.mCharEditBox, this.GetRTFVal(), true)
            } else {
                CharEditBoxPopup_UpdateText(this.mCharEditBox, b, true)
            }
        }
    }
};
DataField.prototype.DOMKeyPress = function(b) {
    if (b.key == 13) {
        return ExecuteWorkflow(this.windowID, 2, this.mID)
    }
};
DataField.prototype.GetHoverValue = function(b) {
    return ""
};
DataField.prototype.GetDataPortion = function() {
    return this.mInputNode
};
DataField.prototype.TracksCaret = true;
DataField.prototype.mDataType = 0;
DataField.prototype.UpdateAccess = function(f) {
    var d = f == 3,
    b = f == 1;
    var h = this.mObj,
    g = h;
    g.className = g.className.replace(SACCESSRE, "");
    if (d) {
        g.className += " dfd"
    }
    while (1) {
        if (g.nodeType == 1 && (g.tagName == "INPUT" || g.tagName == "TEXTAREA")) {
            g.disabled = d;
            g.readOnly = b;
            if (g.tagName == "INPUT" && (g.type == "checkbox" || g.type == "radio")) {
                g.disabled = d | b
            }
            g.style.backgroundColor = (b ? getARFieldROBg_NS(this.windowID) : "")
        } else {
            if (g.nodeType == 1 && g.tagName == "DIV" && FakeButton_Find(g)) {
                FakeButton_SetDisable(g, d)
            }
        }
        if (g.firstChild) {
            g = g.firstChild
        } else {
            while (!g.nextSibling) {
                g = g.parentNode;
                if (g == h) {
                    return
                }
            }
            g = g.nextSibling
        }
    }
};
DataField.prototype.UpdateROColour = function() {
    var d = this.mObj,
    b = d;
    while (1) {
        if (b.nodeType == 1) {
            if (b.tagName == "INPUT" || b.tagName == "TEXTAREA") {
                b.style.backgroundColor = getARFieldROBg_NS(this.windowID);
                return
            }
        }
        if (b.nodeType == 1 && (b.tagName == "DIV" || b.tagName == "FIELDSET" || b.tagName == "LEGEND") && b.firstChild) {
            b = b.firstChild
        } else {
            while (!b.nextSibling) {
                b = b.parentNode;
                if (b == d) {
                    return
                }
            }
            b = b.nextSibling
        }
    }
};
DataField.prototype.GetFocusElement = function() {
    if ("mFocusElement" in this) {
        return this.mFocusElement
    }
    var d = this.mObj,
    b = d;
    while (1) {
        if ((b.nodeType == 1) && ((b.tagName == "INPUT") || (b.tagName == "TEXTAREA") || (b.tagName == "IMG"))) {
            this.mFocusElement = b;
            return b
        }
        if (b.firstChild) {
            b = b.firstChild
        } else {
            while (!b.nextSibling) {
                b = b.parentNode;
                if (b == d) {
                    this.mFocusElement = null;
                    return null
                }
            }
            b = b.nextSibling
        }
    }
};
DataField.prototype.HighlightBorder = function() {
    var b = this.GetDataPortion();
    if (b) {
        b.className += " bHighlight";
        getStateMgr_NS(this.windowID).highlightedFlds.push(this.mID)
    }
};
DataField.prototype.RemoveHighlightBorder = function() {
    var b = this.GetDataPortion();
    if (b) {
        b.className = b.className.replace("bHighlight", "")
    }
};
DataField.prototype.SetDirty = function(b) {
    if (b) {
        if (getCurWFC_NS(this.windowID)) {
            getCurWFC_NS(this.windowID).addDirtyElement(this.mID, b)
        } else {
            FormEvent.FireChangeEvent(b)
        }
    }
    if (! ((this.mID >= 1000000 && this.mID <= 1999999 || this.mID >= 3000000 && this.mID <= 3999999) && getCurWFC_NS(this.windowID))) {
        DataField.superclass.SetDirty.call(this)
    }
};
DataField.prototype.DOMMouseOver = function(b) {
    return hoverState.eventMouseOver(b)
};
DataField.prototype.DOMMouseMove = function(b) {
    return hoverState.eventMouseMove(b)
};
DataField.prototype.DOMMouseOut = function(b) {
    return hoverState.eventMouseOut(b)
};
DataField.prototype.DOMClick = function(b) {
    hoverState.clearTracking()
};
DataField.prototype.getDragHandlePrefixes = function() {
    return ["label"]
};
DataField.prototype.setDecorator = function(f, d) {
    var b = this.GLabel();
    if (d == 1) {
        b = b + f
    } else {
        b = f + b
    }
    this.UpdateLabel(b)
};
DataField.prototype.setBoldness = function(b) {
    var d = this.mTextElement;
    if (!d) {
        return
    }
    if (d.style) {
        if (b) {
            d.style.fontWeight = "bold"
        } else {
            d.style.fontWeight = "normal"
        }
    }
};
DataField.prototype.clearDec = function() {
    if (this.mCFCache.r == 1 || this.mCFCache.r == 0) {
        if (this.mCFCache.r = 1) {
            this.UpdateLabel(this.GLabel());
            this.setBoldness(false)
        }
        if (this.mTextElement) {
            this.mTextElement.style.fontWeight = ""
        }
        this.mCFCache.r = 3
    }
};
function getARKWValuesInstance() {
    var b = [{
        n: "NULL",
        t: 0,
        v: null
    },
    {
        n: "DEFAULT",
        t: 104,
        v: ARKWGetFieldDefault
    },
    {
        n: "USER",
        t: 0,
        v: null
    },
    {
        n: "TIMESTAMP",
        t: 60,
        v: ARKWGetTimeStamp
    },
    {
        n: "TIME",
        t: 60,
        v: ARKWGetTime
    },
    {
        n: "DATE",
        t: 60,
        v: ARKWGetDate
    },
    {
        n: "SCHEMA",
        t: 0,
        v: null
    },
    {
        n: "SERVER",
        t: 0,
        v: null
    },
    {
        n: "WEEKDAY",
        t: 60,
        v: ARKWGetWeekday
    },
    {
        n: "GROUPS",
        t: 0,
        v: null
    },
    {
        n: "OPERATION",
        t: 2,
        v: null
    },
    {
        n: "HARDWARE",
        t: 0,
        v: null
    },
    {
        n: "OS",
        t: 40,
        v: ARKWGetOS
    },
    {
        n: "DATABASE",
        t: 0,
        v: null
    },
    {
        n: "LASTID",
        t: 6,
        v: null
    },
    {
        n: "LASTCOUNT",
        t: 7,
        v: null
    },
    {
        n: "VERSION",
        t: 0,
        v: null
    },
    {
        n: "VUI",
        t: 0,
        v: null
    },
    {
        n: "GUIDETEXT",
        t: 0,
        v: null
    },
    {
        n: "FIELDHELP",
        t: 64,
        v: null
    },
    {
        n: "GUIDE",
        t: 40,
        v: ARKWGetGuide
    },
    {
        n: "APPLICATION",
        t: 0,
        v: null
    },
    {
        n: "LOCALE",
        t: 0,
        v: null
    },
    {
        n: "CLIENT-TYPE",
        t: 1,
        v: null
    },
    {
        n: "SCHEMA-ALIAS",
        t: 0,
        v: null
    },
    {
        n: "ROWSELECTED",
        t: 45,
        v: ARKWGetRowSelected
    },
    {
        n: "ROWCHANGED",
        t: 41,
        v: ARKWGetRowChanged
    },
    {
        n: "BROWSER",
        t: 40,
        v: ARKWGetBrowserVersion
    },
    {
        n: "VUI-TYPE",
        t: 0,
        v: null
    },
    {
        n: "TCPPORT",
        t: 1,
        v: null
    },
    {
        n: "HOMEURL",
        t: 2,
        v: null
    },
    {
        n: "ROLES",
        t: 0,
        v: null
    },
    {
        n: "EVENTTYPE",
        t: 2,
        v: null
    },
    {
        n: "EVENTSRCWINID",
        t: 2,
        v: null
    },
    {
        n: "CURRENTWINID",
        t: 2,
        v: null
    },
    {
        n: "LASTOPENEDWINID",
        t: 2,
        v: null
    },
    {
        n: "INBULKTRANSACTION",
        t: 1,
        v: null
    },
    {
        n: "FIELDID",
        t: 40,
        v: ARKWGetFieldIDInFocus
    },
    {
        n: "FIELDNAME",
        t: 40,
        v: ARKWGetFieldNameInFocus
    },
    {
        n: "FIELDLABEL",
        t: 40,
        v: ARKWGetFieldLabelInFocus
    },
    {
        n: "SERVERTIMESTAMP",
        t: 60,
        v: ARKWGetServerTimeStamp
    },
    {
        n: "GROUPIDS",
        t: 0,
        v: null
    },
    {
        n: "EVENTDATA",
        t: 2,
        v: null
    },
    {
        n: "ERRNOFILTER",
        t: 40,
        v: ARKGetErrNoFilter
    },
    {
        n: "ERRMSGFILTER",
        t: 40,
        v: ARKGetErrMsgFilter
    },
    {
        n: "ERRAPPMSGFILTER",
        t: 40,
        v: ARKGetAppMsgFilter
    },
    {
        n: "INCLNTMANTRANS",
        t: 40,
        v: ARKGetClientManagedTrans
    },
    {
        n: "DRAGSRCFIELDID",
        t: 40,
        v: ARKWGetDragSourceFieldID
    },
    {
        n: "DROPTGTFIELDID",
        t: 40,
        v: ARKWGetDropTargetFieldID
    },
    {
        n: "SHIFT_KEY",
        t: 3,
        v: null
    },
    {
        n: "ALT_KEY",
        t: 3,
        v: null
    },
    {
        n: "CTRL_KEY",
        t: 3,
        v: null
    }];
    return b
}
function ARKWSetup(b, d) {
    for (var f = 0; f < d.length - 1; f += 2) {
        getARKWValues_NS(b)[d[f]].v = d[f + 1]
    }
}
function ARKWSet(d, b, f) {
    getARKWValues_NS(d)[b].v = f
}
function ARKWGetByIdx(f, d, b) {
    var g;
    if ((((getARKWValues_NS(f)[d]).t & 32) != 0)) {
        g = getARKWValues_NS(f)[d].v(f, b)
    } else {
        g = getARKWValues_NS(f)[d].v
    }
    if (g != null) {
        if (g instanceof Datatype) {
            return g
        } else {
            if ((((getARKWValues_NS(f)[d]).t & 1) != 0)) {
                return new IntegerType(g)
            } else {
                if ((((getARKWValues_NS(f)[d]).t & 1) == 0)) {
                    return new CharType(g)
                }
            }
        }
    }
    return Null
}
function ARKWGetByNegIdx(f, d, b) {
    d = ( - d) + 1;
    return ARKWGetByIdx(f, d, b)
}
function ARKWGetNameByIdx(d, b) {
    return getARKWValues_NS(d)[b].n
}
function ARKWGetKeywordIdx(b, d) {
    return getARKWNameLookup_NS(b)[d]
}
function ARKWGetByName(d, f, b) {
    return ARKWGetByIdx(d, getARKWNameLookup_NS(d)[f], b)
}
function ARKWGetStringByIdx(f, d, b) {
    var g = ARKWGetJSNativeByIdx(f, d, b);
    return g
}
function ARKWGetJSNativeByIdx(f, d, b) {
    var g;
    if ((((getARKWValues_NS(f)[d]).t & 32) != 0)) {
        g = getARKWValues_NS(f)[d].v(f, b)
    } else {
        g = getARKWValues_NS(f)[d].v
    }
    return g
}
function ARKWIsKeywordIdx(b) {
    return (b >= 0 && b <= 51)
}
function ARKWIsKeywordName(b, d) {
    return (typeof getARKWNameLookup_NS(b)[d] != "undefined")
}
function ARKWIsKeywordOrEscapedKeyword(b, d) {
    if ((ARKWIsKeywordName(b, d)) || (d.length > 2 && d.charAt(0) == "\\" && ARKWIsKeywordName(b, d.substr(1)))) {
        return true
    }
    return false
}
function ARKWIsKeywordString(b, d) {
    if (typeof d == "string" || d instanceof CharType) {
        d = d.toString();
        if (d.length > 2 && d.charAt(0) == "$" && d.charAt(d.length - 1) == "$") {
            return ARKWIsKeywordName(b, d.substring(1, d.length - 1))
        }
    }
    return false
}
function ARKWIsTemporal(d, b) {
    return (((getARKWValues_NS(d)[b]).t & 4) != 0)
}
function ARKWIsTemporalString(b, d) {
    if (typeof d == "string" || d instanceof CharType) {
        d = d.toString();
        if (d.length > 2) {
            d = d.substring(1, d.length - 1);
            if (typeof getARKWNameLookup_NS(b)[d] != "undefined") {
                return (((getARKWValues_NS(b)[getARKWNameLookup_NS(b)[d]]).t & 4) != 0)
            }
        }
    }
    return false
}
function ARKWIsTimeRelated(d, b) {
    return (((getARKWValues_NS(d)[b]).t & 16) != 0)
}
function ARKWIsConstant(d, b) {
    return (((getARKWValues_NS(d)[b]).t & 2) == 0)
}
var realtimeKeyMap = {};
realtimeKeyMap[49] = realtimeKeyMap[50] = realtimeKeyMap[51] = 0;
var keyRefCnt = 0;
function ARKWSetShifCtrlAltToRealtime() {
    var b = getTopWinWindowID_NS();
    setShifCtrlAltRecursive(b, realtimeKeyMap[49], realtimeKeyMap[51], realtimeKeyMap[50])
}
function setShifCtrlAltRecursive(f, p, h, d) {
    ARKWSet(f, 49, p);
    ARKWSet(f, 51, h);
    ARKWSet(f, 50, d);
    var b = getLogicalChildWindowIDs(f);
    if (b == null || b.length == 0) {
        return
    }
    var o = b.length;
    for (var k = 0; k < o; k++) {
        var g = b[k];
        if (getFormContext(g)) {
            setShifCtrlAltRecursive(g, p, h, d)
        }
    }
}
function ARKWGetTime() {
    return new TODKWType()
}
function ARKWGetTimeStamp() {
    var b = new Date().UnixTimestamp();
    return new TimeType(b)
}
function ARKWGetServerTimeStamp(b) {
    var d = new NDXGetServerTimestamp(b, ARKWGetStringByIdx(b, 7)).GetResult();
    return new TimeType(d)
}
function ARKWGetDate() {
    return new DateKWType()
}
function ARKWGetWeekday() {
    return new WeekdayKWType()
}
function ARKWGetFieldDefault(windowID, fieldid) {
    if (typeof fieldid == "undefined") {
        return null
    }
    if (fieldid in getDefaults_NS(windowID) && "d" in getDefaults_NS(windowID)[fieldid]) {
        var defStr = ExpandString(windowID, "" + getDefaults_NS(windowID)[fieldid].d, (F(windowID, fieldid) instanceof JColumn) ? 1 : 4);
        if ("de" in getDefaults_NS(windowID)[fieldid]) {
            defStr = ExpandString(windowID, "" + getDefaults_NS(windowID)[fieldid].de, (F(windowID, fieldid) instanceof JColumn) ? 1 : 4);
            return eval(defStr)
        } else {
            return defStr
        }
    }
    return null
}
function ARKWGetFieldIDInFocus(b) {
    return FocusMgr.getFocusedID() + ""
}
function ARKWGetFieldNameInFocus(b) {
    var d = FocusMgr.getFocusedID();
    return F(b, d).GName()
}
function ARKWGetFieldLabelInFocus(b) {
    var d = FocusMgr.getFocusedID();
    return F(b, d).GLabel()
}
function ARKWGetBrowserVersion() {
    var g = navigator.userAgent;
    var b = "";
    var k = "IE";
    var f = g.indexOf(k);
    if (f != -1 && g.charAt(f + k.length) == " ") {
        var h = f + k.length + 1;
        var d = g.indexOf(";", h);
        if (d != -1) {
            b = g.substr(h, d - h)
        }
    } else {
        if (g.indexOf("Gecko") != -1) {
            b = "7"
        }
    }
    if (b.length <= 0) {
        b = "unknown"
    }
    return navigator.appName + b
}
function ARKWGetGuide(b) {
    if (getCurWFC_NS(b)) {
        var d = getCurWFC_NS(b).getGuideState();
        if (d != null) {
            return d.g
        }
    }
    return null
}
function ARKWGetRowSelected(b) {
    if (getCurWFC_NS(b)) {
        var d = getCurWFC_NS(b).getGuideState();
        if (d != null) {
            if ("table" in d) {
                return d.table.GetRowSelected(d.currow)
            }
        }
    }
    return null
}
function ARKWGetRowChanged(b) {
    if (getCurWFC_NS(b)) {
        var d = getCurWFC_NS(b).getGuideState();
        if (d != null) {
            if ("table" in d) {
                return d.table.GetRowState(d.currow)
            }
        }
    }
    return null
}
function ARKWSetLASTID(b, d) {
    ARKWGetGlobalKeywords(b);
    ARKWSet(b, 14, d);
    ARKWSetGlobalKeywords(b)
}
function ARKWSetLASTCOUNT(b, d) {
    ARKWGetGlobalKeywords(b);
    ARKWSet(b, 15, d);
    ARKWSetGlobalKeywords(b)
}
function ARKWSetGlobalKeywords(b) {
    var d = {};
    d[14] = getARKWValues_NS(b)[14];
    d[15] = getARKWValues_NS(b)[15];
    SerializeGlobals(b, "GKW", d)
}
function ARKWGetGlobalKeywords(d) {
    var f = DeserializeGlobals("GKW");
    if (f != null) {
        for (var b in f) {
            getARKWValues_NS(d)[b] = f[b]
        }
    }
}
function ARKWGetOS() {
    var d = new Array("unknown", "unknown");
    brs = navigator.userAgent.toLowerCase();
    if (brs.search(/windows\sce/) != -1) {
        d[0] = "Windows CE";
        try {
            d[1] = brs.match(/windows\sce\/(\d+(\.?\d)*)/)[1]
        } catch(f) {}
        return d[0]
    } else {
        if ((brs.search(/windows/) != -1) || ((brs.search(/win9\d{1}/) != -1))) {
            var g = d[0] = "Windows";
            if (brs.search(/nt\s6\.0/) != -1) {
                d[1] = " Vista/2008 Server"
            }
            if (brs.search(/nt\s5\.1/) != -1) {
                d[1] = " XP"
            } else {
                if (brs.search(/nt\s5\.0/) != -1) {
                    d[1] = " 2000"
                } else {
                    if ((brs.search(/win98/) != -1) || (brs.search(/windows\s98/) != -1)) {
                        d[1] = " 98"
                    } else {
                        if (brs.search(/windows\sme/) != -1) {
                            d[1] = " Me"
                        } else {
                            if (brs.search(/nt\s5\.2/) != -1) {
                                d[1] = " 2003"
                            } else {
                                if ((brs.search(/windows\s95/) != -1) || (brs.search(/win95/) != -1)) {
                                    d[1] = " 95"
                                } else {
                                    if ((brs.search(/nt\s4\.0/) != -1) || (brs.search(/nt4\.0/)) != -1) {
                                        d[1] = " NT 4"
                                    } else {
                                        var b = brs.indexOf("nt") + 2;
                                        d[1] = " " + brs.substring(b, brs.indexOf(";", b))
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (null != d[1]) {
                g = d[0] + d[1]
            }
            return g
        } else {
            if (brs.search(/linux/) != -1) {
                var g = "Linux";
                return g
            } else {
                if (brs.search(/sunos/) != -1) {
                    g = "sunos";
                    return g
                } else {
                    if ((brs.search(/macintosh/) != -1) || (brs.search(/mac\x5fpowerpc/) != -1)) {
                        d[0] = "macclassic";
                        return d[0]
                    } else {
                        if (brs.search(/os\/2/) != -1) {
                            g = "os2";
                            return g
                        } else {
                            if (brs.search(/hp\-ux/) != -1) {
                                g = "hpux";
                                return g
                            } else {
                                d[0] = "unknown";
                                return d[0]
                            }
                        }
                    }
                }
            }
        }
    }
}
function ARKGetErrNoFilter() {
    return null
}
function ARKGetErrMsgFilter() {
    return null
}
function ARKGetAppMsgFilter() {
    return null
}
function ARKGetClientManagedTrans() {
    return null
}
function ARKWGetDragSourceFieldID() {
    return MidTierDragDropMgrInst.getLastDragSourceFieldID()
}
function ARKWGetDropTargetFieldID() {
    return MidTierDragDropMgrInst.getLastDropTargetFieldID()
}
function ShowWaitCursor() {
    return false
}
function StateMgr_Init(d) {
    setARStateCurrent_NS(d, 0);
    var b = new
    function() {
        this.windowID = d;
        var u = ["NONE", "CREATE", "DIALOG", "GET", "QUERY", "SET", "SET ALL"];
        var E = [getLocalizedMessage("{0} (NONE)"), getLocalizedMessage("{0} (New)"), "{0} ({1})", getLocalizedMessage("{0} (Display)"), getLocalizedMessage("{0} (Search)"), getLocalizedMessage("{0} (Modify)"), getLocalizedMessage("{0} (Modify All)")];
        var ag = {
            0 : [2],
            1 : [4],
            2 : [1],
            3 : [4, 5, false],
            4 : [4, 5, true],
            5 : [4, 5, false],
            6 : [4, 3, false],
            7 : [4, 3, true],
            8 : [4, 3, false],
            9 : [0],
            10 : [4, 5, false],
            11 : [4, 3, false],
            12 : [0, 5, false],
            13 : [0, 5, false],
            14 : [0, 5, true],
            15 : [0, 5, false],
            16 : [0, 3, false],
            17 : [0, 3, false],
            18 : [0, 3, true],
            19 : [0, 3, false],
            99 : [4, 5, true]
        };
        this.OpenWindowStates = ag;
        this.OpenWindowFunctions = {
            0 : FormAction_NewSearch,
            1 : FormAction_NewRequest,
            2 : FormAction_NewDialog,
            4 : FormAction_NewSearch
        };
        var f = false,
        ab = [],
        s = true,
        L = false;
        this.mWindowIsClosed = false;
        ab.S01 = [at, am, Z, Y, aA, K, S, an];
        ab.S02 = [Y, aA, am, an];
        ab.S03 = [A, at, am, an, aD, aw, k, D];
        ab.S04 = [at, am, Y, aA, K, an];
        ab.S05 = [A, at, am, an, aD, aw, k, D];
        ab.S06 = [A, at, am, an];
        ab.S10 = [W, ae, o, Z];
        ab.S20 = [W, o, Z];
        ab.S30 = [az, ay, W, o, Z, ax];
        ab.S40 = [W, o, Z];
        ab.S50 = [az, W, ae, ay, o, Z, ax];
        ab.S60 = [W, ae, o, Z, ax];
        ab.S15 = [at, am, aD, aw, k, D];
        ab.S33 = [az, ay, aE, aw, k, D];
        ab.S55 = [az, ae, ay, Z, aE, A, aw, k, D];
        ab.S61 = ab.S64 = ab.S66 = ab.S65 = ab.S41 = ab.S44 = ab.S45 = ab.S43 = ab.S46 = ab.S31 = ab.S34 = ab.S51 = ab.S54 = ab.S56 = ab.S11 = ab.S14 = [y];
        this.ARStateChange = B;
        function B(aI, aJ) {
            if (RTF_Close && typeof RTF_Close != "undefined") {
                RTF_Close(aI, true)
            }
            var aL = getARStateCurrent_NS(aI);
            L = true;
            var aH = ab[(("S" + (aL)) + (aJ))];
            var aK = {
                i: 0,
                cs: aL,
                ns: aJ
            };
            return {
                c: {
                    f: aG,
                    a: [aI, aH, aK]
                },
                n: {
                    f: aF,
                    a: [aI, aK]
                }
            }
        }
        function aF(aH, aI) {
            s = false;
            var aJ = getARStateCurrent_NS(aH);
            if (aI.ab) {
                ARKWSet(aH, 10, u[aJ]);
                getStateMgr_NS(aH).mWindowIsClosed = false;
                al(aH, aJ)
            } else {
                if (aJ != 0) {
                    H(aH);
                    DControl_UpdateFormActionButtons(aH);
                    Form_UpdateToolbar(aH)
                }
            }
            L = false
        }
        function y(aH, aL) {
            var aI = {
                i: 0,
                cs: 0,
                ns: aL.ns,
                pas: aL
            };
            var aM = {
                i: 0,
                cs: aL.cs,
                ns: 0,
                nss: aI,
                pas: aL
            };
            var aK = ab[(("S" + (aL.cs)) + (0))];
            var aJ = ab[(("S" + (0)) + (aL.ns))];
            return {
                c: {
                    f: aG,
                    a: [aH, aK, aM]
                },
                n: {
                    f: aG,
                    a: [aH, aJ, aI]
                }
            }
        }
        function aG(aH, aI, aK) {
            var aJ = aK.i;
            if (aK.ab) {
                return
            }
            if (getWindowArgs_NS(aH) != null && (getWindowArgs_NS(aH).wMode == 99 || "eid" in getWindowArgs_NS(aH)) && aK.cs == 0 && aK.ns == 4) {
                setARStateCurrent_NS(aH, aK.ns);
                getWindowArgs_NS(aH).wMode = 4;
                return
            }
            if ((aJ == 0) && (aK.cs == 0 || (aK.cs == 1 && aK.ns == 5))) {
                setARStateCurrent_NS(aH, aK.ns);
                ARKWSet(aH, 10, u[aK.ns]);
                al(aH, aK.ns)
            }
            if (aJ < aI.length) {
                aK.i++;
                return {
                    c: {
                        f: aI[aJ],
                        a: [aH, aK],
                        e: Q,
                        ea: [aH, aK, false]
                    },
                    n: {
                        f: aG,
                        a: [aH, aI, aK]
                    }
                }
            }
        }
        function C(aH) {
            aH.ab = 1;
            if (aH.nss) {
                aH.nss.ab = 1
            }
            if (aH.pas) {
                aH.pas.ab = 1
            }
        }
        function Q(aH, aI, aJ, aK) {
            if ((aH instanceof WorkflowException) && aH.hasMessages() && (aH.getCode() != 5)) {
                if (aK) {
                    C(aJ)
                }
                return WC_DisplayMessage(aI, aH.getLStatus())
            } else {
                throw aH
            }
        }
        this.InTransition = function() {
            return L
        };
        function al(aI, aJ) {
            if (aI != getTopWinWindowID_NS()) {
                return
            }
            var aL = (aJ == 4) ? getARTitles_NS(aI).pluralLong: getARTitles_NS(aI).singleLong;
            if (aL == "") {
                aL = ARKWGetStringByIdx(aI, 6)
            }
            window.title = document.title = getLocalizedMessage(E[aJ], [aL, ARKWGetStringByIdx(aI, 7)]);
            try {
                if (window.frameElement && window.frameElement.parentNode && window.frameElement.parentNode.className.indexOf("DIVPopupBody") != -1) {
                    var aH = window.frameElement.parentNode.parentNode;
                    if (aH.previousSibling && aH.previousSibling.tagName == "TR") {
                        var aM = aH.previousSibling.getElementsByTagName("DIV");
                        if (aM.length > 0) {
                            aM[0].innerHTML = window.title.HTMLEncode() + "&nbsp;&nbsp;&nbsp;"
                        }
                    }
                }
            } catch(aK) {}
        }
        this.GetToolbarTitle = function() {
            var aH = getLocalizedMessage(E[getARStateCurrent_NS(this.windowID)], ["", ""]);
            return aH.match(/\((.*?)\)/)[1]
        };
        this.GetActionButtonString = function() {
            if (getARStateCurrent_NS(this.windowID) == 4) {
                return getLocalizedMessage("Search", null)
            } else {
                return getLocalizedMessage("Save", null)
            }
        };
        var P = false;
        function aA(aH, aK) {
            var aI = getWindowArgs_NS(aH);
            if (aI != null && "fvlist" in aI) {
                for (var aL in aI.fvlist) {
                    if (typeof(aI.fvlist[aL]) != "function") {
                        if (aL in getFields_NS(aH)) {
                            var aN = Datatype_Factory(aI.fvlist[aL]);
                            if (aN instanceof CharType) {
                                aN = new CharType(ExpandString(aH, aN.toString(), 2 | 4))
                            }
                            getFields_NS(aH)[aL].S(aN)
                        }
                    }
                }
                getWindowArgs_NS(aH).fvlist = null
            }
            if ("olserver" in window.URLParams) {
                F(aH, 1041).S(new CharType(window.URLParams.olserver))
            }
            if ("olapp" in window.URLParams) {
                F(aH, 1042).S(new CharType(window.URLParams.olapp))
            }
            if (!P) {
                var aM;
                for (var aJ in window.URLParams) {
                    if (aJ.charAt(0) == "F" && aJ.length > 1) {
                        var aM = parseInt(aJ.substr(1));
                        if (!isNaN(aM) && aM > 0 && aM in getFields_NS(aH)) {
                            getFields_NS(aH)[aM].S(new CharType(window.URLParams[aJ]))
                        }
                    }
                }
                P = true
            }
        }
        function am(aI, aJ) {
            Field_Defaults(aI, 0, 1, (aJ.ns == 3) ? 1 : 0);
            var aH = (aJ.ns == 4) ? 2 : 1;
            if (aJ.ns == 2) {
                aH = 2
            }
            for (ii in getForm_NS(aI).systemFields) {
                F(aI, ii).SAccess(aH)
            }
            Field_ClearChanged(aI);
            getStateMgr_NS(aI).mWindowIsClosed = false;
            HidePromptBar();
            return {
                n: {
                    f: ExecuteWorkflow,
                    a: [aI, 16384],
                    e: ai,
                    ea: [aI, aJ]
                }
            }
        }
        function ai(aH, aI, aJ) {
            if (aH instanceof WorkflowException && aH.hasMessages()) {
                C(aJ);
                this.mWindowIsClosed = true;
                Field_ClearChangedFromRunProcess(aI);
                return {
                    n: {
                        f: function() {
                            return {
                                c: {
                                    f: WC_DisplayMessage,
                                    a: [aI, aH.getLStatus()]
                                },
                                n: {
                                    f: ARACTCloseWindow,
                                    a: [aI, 0]
                                }
                            }
                        }
                    }
                }
            }
            throw aH
        }
        var q, ao;
        function aD(aH, aI) {
            q = new FieldSnapshot(aH, false, true)
        }
        function S(aH, aI) {
            ao = new FieldSnapshot(aH, false, true)
        }
        function aE(aH) {
            q.Restore()
        }
        function K(aH, aI) {
            return ExecuteWorkflow(aH, 262144)
        }
        function an(aH, aI) {
            DAppList.Load(aH)
        }
        this.WindowIsClosing = function(aI) {
            if (this.mWindowIsClosed) {
                return
            }
            var aH = {
                n: {
                    f: W,
                    a: [this.windowID, aI]
                }
            };
            if ((getARStateCurrent_NS(this.windowID) == 5) || (getARStateCurrent_NS(this.windowID) == 3)) {
                aH.c = ({
                    f: az,
                    a: [this.windowID, aI]
                })
            }
            return aH
        };
        function W(aH, aK) {
            if (aK.ab) {
                return
            }
            var aJ = {};
            aJ.c = {
                f: function() {
                    getStateMgr_NS(aH).mWindowIsClosed = true
                }
            };
            var aI = getWindowArgs_NS(aH);
            if (! (aK.cs == 4 && aK.ns == 0 && aI && "eid" in aI)) {
                if (aH == getTopWinWindowID_NS()) {
                    HidePromptBar()
                }
                aJ.n = {
                    f: ExecuteWorkflow,
                    a: [aH, 32768],
                    e: function() {
                        getStateMgr_NS(aH).mWindowIsClosed = false;
                        Q.apply(null, arguments)
                    },
                    ea: [aH, aK, true]
                }
            }
            return aJ
        }
        this.ClearSnapshot = o;
        function o() {
            q = ao = null;
            this.mWindowIsClosed = true
        }
        function Y(aH, aI) {
            var aJ = 1;
            if (aI.ns == 1) {
                aJ = ARPrefsGetAsNumber(20101)
            } else {
                if (aI.ns == 4) {
                    aJ = ARPrefsGetAsNumber(20102)
                } else {
                    if (aI.ns == 2) {
                        aJ = 0
                    }
                }
            }
            if (getWindowArgs_NS(aH) != null && "wForceClear" in getWindowArgs_NS(aH) && getWindowArgs_NS(aH).wForceClear == 1) {
                getWindowArgs_NS(aH).wForceClear = 0;
                p(aH, true);
                if ("fvSetDefaults" in getWindowArgs_NS(aH) && getWindowArgs_NS(aH).fvSetDefaults == 1) {
                    aJ = 1
                } else {
                    return
                }
            }
            switch (aJ) {
            case 0:
                return p(aH, true);
            case 1:
                return aq(aH, true);
            case 2:
                return R(aH, aI)
            }
            return false
        }
        function aq(aH, aI, aK) {
            var aJ = getFieldChanged_NS(aH);
            Field_Defaults(aH, 1, 0, 0);
            if (aK && !aJ) {
                Field_ClearChangedFromRunProcess(aH, aJ)
            }
            if (aI) {
                Z(aH)
            }
            return ExecuteWorkflow(aH, 512)
        }
        this.SetDefaults = aq;
        function R(aH, aI) {
            if (aI.ns == 1) {
                if (s) {
                    return aq(aH, true)
                }
                for (ii in getForm_NS(aH).systemFields) {
                    F(aH, ii).Clear()
                }
                Z(aH)
            } else {
                if (aI.ns == 4) {
                    if (s) {
                        return p(aH, true)
                    }
                }
            }
            DAttachmentPool_DoEntryChange(aH, false);
            return ExecuteWorkflow(aH, 512)
        }
        function af(aH) {
            var aI = false;
            for (var aJ = 0; aJ < getCharEditPopups_NS(aH).length; aJ++) {
                if (getCharEditPopups_NS(aH)[aJ].NewTextAvail()) {
                    aI = true;
                    break
                }
            }
            return aI
        }
        function O(aI) {
            var aJ;
            var aH = getCharEditPopups_NS(aI);
            for (var aK = 0; aK < aH.length; aK++) {
                if (aH[aK].NewTextAvail()) {
                    aJ = aH[aK].GetText();
                    F(aI, aH[aK].mField.mID).S(new CharType(aJ))
                }
            }
        }
        function g() {
            if (typeof rtfEditor != "undefined" && rtfEditor && rtfEditor.IsVisible()) {
                rtfEditor.Close(true)
            }
        }
        function ae(aI, aK) {
            g();
            var aL = ar(aI) && getFieldChanged_NS(aI);
            var aH = af(aI);
            if (aL || aH) {
                if (aK.cs == 1 || aK.cs == 5 || aK.cs == 6) {
                    var aJ = {};
                    return {
                        c: {
                            f: ConfirmPopup,
                            a: [aI, getLocalizedMessage("Do you want to save the current request ?"), aJ, 1 | 8 | 4]
                        },
                        n: {
                            f: function() {
                                if (! ("v" in aJ.result) || aJ.result.v == -1) {
                                    C(aK);
                                    if (aK.cs == 5) {
                                        var aM = getFields_NS(aI)[1020];
                                        return {
                                            c: {
                                                t: aM,
                                                f: aM.RestoreResultsListToPrevSelection,
                                                a: []
                                            }
                                        }
                                    }
                                } else {
                                    if (aJ.result.v == 1) {
                                        if (aH) {
                                            O(aI)
                                        }
                                        if (aK.cs == 1) {
                                            return {
                                                c: {
                                                    f: function() {
                                                        return {
                                                            c: {
                                                                f: aB,
                                                                a: [aI]
                                                            }
                                                        }
                                                    },
                                                    e: Q,
                                                    ea: [aI, aK, true]
                                                }
                                            }
                                        }
                                        if (aK.cs == 5 || aK.cs == 6) {
                                            return {
                                                c: {
                                                    f: function() {
                                                        return {
                                                            c: {
                                                                f: ak,
                                                                a: [aI]
                                                            }
                                                        }
                                                    },
                                                    e: Q,
                                                    ea: [aI, aK, true]
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        function Z(aH) {
            Field_ClearChanged(aH)
        }
        function at(aH, aI) {
            if (aI.ns == 5 || aI.ns == 6 || aI.ns == 3) {
                Field_Clear(aH, true)
            } else {
                var aJ = 0;
                if (aI.ns == 1) {
                    aJ = ARPrefsGetAsNumber(20101)
                } else {
                    if (aI.ns == 4) {
                        aJ = ARPrefsGetAsNumber(20102)
                    }
                }
                if (aJ != 2) {
                    Field_Clear(aH, false)
                }
            }
        }
        function p(aH, aI) {
            Field_Clear(aH, false);
            if (aI) {
                Z(aH)
            }
        }
        function aj(aH) {
            g();
            if (af(aH)) {
                O(aH)
            }
            return {
                c: {
                    f: J,
                    a: [aH]
                },
                n: {
                    f: ah,
                    a: [aH, 5, false]
                }
            }
        }
        this.Query = aj;
        function aC(aH, aJ, aI) {
            if (aJ == 12 || aJ == 13 || aJ == 14 || aJ == 15 || aJ == 16 || aJ == 17 || aJ == 18 || aJ == 19) {
                return {
                    c: {
                        f: ah,
                        a: [aH, ag[aJ][1], ag[aJ][2], aI]
                    }
                }
            }
            return {
                c: {
                    f: J,
                    a: [aH]
                },
                n: {
                    f: ah,
                    a: [aH, ag[aJ][1], ag[aJ][2], aI]
                }
            }
        }
        this.OpenWindowQuery = aC;
        function J(aH) {
            if (!getCurWFC_NS(aH)) {
                HidePromptBar()
            }
            return ExecuteWorkflow(aH, 1024)
        }
        function ah(aL, aI, aQ, aR) {
            var aT = getFields_NS(aL)[1020];
            f = aQ;
            var aU;
            var aP = "";
            var aJ = "";
            var aH = null;
            var aN = Field_GetQBEFieldList(aL);
            aU = aN.fl;
            aH = aN.ps;
            if (typeof aR == "undefined") {
                aJ = F(aL, 1005).G().toString();
                if (aJ != "") {
                    var aM = aJ.match(SavedSearches.PSP);
                    if (aM != null) {
                        for (var aO = 0; aO < aM.length; aO++) {
                            var aK = aM[aO];
                            aK = aK.substring(1, aK.length - 1);
                            if (!ARKWIsKeywordOrEscapedKeyword(aL, aK)) {
                                if (aH == null) {
                                    aH = new Object()
                                }
                                aH[aK] = aK
                            }
                        }
                    }
                    aP = aJ
                }
            }
            var aS = {};
            return {
                c: {
                    f: function(aV) {
                        if (aV != null) {
                            return ParamSearchPopup(aL, aS, aV)
                        }
                    },
                    a: [aH]
                },
                n: {
                    f: function(a0, aW) {
                        var a3 = aW;
                        if (a0 && "result" in a0 && "v" in a0.result) {
                            for (var aV in a0.result.v) {
                                var aZ = getFields_NS(aL)[aV];
                                var a2 = a0.result.v[aV].toString();
                                if (aZ) {
                                    if (a2 != "") {
                                        var a2 = aZ.FromUIInput(a2, false, true);
                                        aU.AddField(aV, a2)
                                    }
                                } else {
                                    aV = aV.toRegExp();
                                    var aX = new RegExp("\\$" + aV + "\\$", "g");
                                    aW = aW.replace(aX, a2)
                                }
                            }
                        } else {
                            if (aH != null) {
                                return
                            }
                        }
                        if (aW != "") {
                            aW = new NDXParseAndEncodeQualifier(aL, ARKWGetStringByIdx(aL, 7), ARKWGetStringByIdx(aL, 6), ARKWGetStringByIdx(aL, 17), aW).result
                        }
                        var a1 = {
                            label: "",
                            ids: [],
                            vals: []
                        };
                        if (getuserSearches_NS(aL) != null) {
                            if (getuserSearches_NS(aL).SaveRecent(aL, aU.mFields, aH, a3)) {
                                a1 = getuserSearches_NS(aL).lastSearch
                            }
                        }
                        quickReportParamSearch = "";
                        quickReportRegularSearch = "";
                        quickReportAdvancedSearchQual = "";
                        if (a3 != "") {
                            quickReportAdvancedSearchQual = a3
                        }
                        var aV;
                        for (aV in aU.mFields) {
                            if ((aH != null) && (aV in aH)) {
                                if (quickReportParamSearch.length > 0) {
                                    quickReportParamSearch += "/"
                                }
                                quickReportParamSearch += aV + "/$" + aH[aV] + "$"
                            } else {
                                var aZ = F(aL, aV);
                                var aY = aZ.GetScreenValue();
                                quickReportRegularSearch += aV + "/" + aY.length + "/" + aY + "/"
                            }
                        }
                        if (aI < 100) {
                            return {
                                c: {
                                    t: aT,
                                    f: aT.LoadResultsList,
                                    a: [aI, aR, aU, aW, getForm_NS(aL).currentFormVuiId, a1.label, a1.ids, a1.vals]
                                },
                                n: {
                                    f: B,
                                    a: [aL, aI]
                                }
                            }
                        }
                    },
                    a: [aS, aP]
                }
            }
        }
        this.QueryEntry = ah;
        function k(aH, aI) {
            if (getWindowArgs_NS(aH) && "eid" in getWindowArgs_NS(aH)) {
                delete getWindowArgs_NS(aH).eid
            }
            HidePromptBar();
            if (aI.cs == 1 && aI.ns == 5) {
                return {
                    n: {
                        f: ExecuteWorkflow,
                        a: [aH, 16]
                    }
                }
            }
            return {
                c: {
                    f: ExecuteWorkflow,
                    a: [aH, 16]
                },
                n: {
                    f: ac,
                    a: [aH, 0],
                    e: Q,
                    ea: [aH, aI, false]
                }
            }
        }
        function az(aH, aI) {
            return {
                c: {
                    f: ExecuteWorkflow,
                    a: [aH, 65536],
                    e: X,
                    ea: [aH, aI]
                }
            }
        }
        function ay(aH, aI) {
            return {
                c: {
                    f: ac,
                    a: [aH, 1]
                }
            }
        }
        function X(aH, aI, aK) {
            if ((aH instanceof WorkflowException) && aH.hasMessages()) {
                C(aK);
                var aJ = getFields_NS(aI)[1020];
                return {
                    n: {
                        f: function() {
                            return {
                                c: {
                                    f: WC_DisplayMessage,
                                    a: [aI, aH.getLStatus()]
                                },
                                n: {
                                    t: aJ,
                                    f: aJ.RestoreResultsListToPrevSelection,
                                    a: []
                                }
                            }
                        }
                    }
                }
            }
            throw aH
        }
        function ac(aH, aI) {
            if (aI.ab == 1) {
                return
            }
            return {
                c: {
                    f: DTable_DoEntryChange,
                    a: [aH, aI]
                },
                n: {
                    f: DAttachmentPool_DoEntryChange,
                    a: [aH, true]
                }
            }
        }
        function D(aH, aJ) {
            for (var aK in getTemplateFields_NS(aH)) {
                var aI = getTemplateFields_NS(aH)[aK];
                if (aI != null) {
                    getCurWFC_NS(aH).AddCallback(aI, aI.setContents, [])
                }
            }
        }
        function aw(aH, aK) {
            if (aK.cs == 1 && aK.ns == 5) {
                buildResultListEntry(aH, getForm_NS(aH).reqIdStr, aK.ns);
                Field_LoadEntry(aH, getForm_NS(aH).entry, false, true, getForm_NS(aH).reqIdStr);
                return
            }
            var aJ = getFields_NS(aH)[1020];
            var aL = aJ.GetRow();
            if (aL == -1) {
                Field_Clear(aH, true);
                Field_ClearChanged(aH)
            } else {
                if ("e" in aJ.mResult) {
                    Field_LoadEntry(aH, aJ.mResult.e, false, true, aJ.mResult.eid);
                    delete aJ.mResult.e
                } else {
                    var aI = Field_QueryLoadEntry(aH, aJ.mResult.r[aL].i, false, true);
                    return aI
                }
            }
        }
        function A(aH, aJ) {
            var aK = false;
            if (typeof getForm_NS(aH).procGetEntry != "undefined") {
                aK = getForm_NS(aH).procGetEntry
            }
            if (!getForm_NS(aH).UseResultsListPane || !f) {
                var aI = getFields_NS(aH)[1020];
                aI.SVis(true)
            }
            if (aK == false && !f && getForm_NS(aH).UseResultsListPane) {
                ShowResultsListPane(aH)
            }
            if (aK) {
                getForm_NS(aH).procGetEntry = false
            }
        }
        function ax(aH, aJ) {
            var aI = getFields_NS(aH)[1020];
            aI.SVis(false);
            if (!f && getForm_NS(aH).UseResultsListPane) {
                HideResultsListPane(aH)
            }
            if (! ((aJ.cs == 5 && aJ.nss.ns == 6) || (aJ.cs == 6 && aJ.nss.ns == 5) || (aJ.cs == 6 && aJ.nss.ns == 6))) {
                aI.Clear()
            }
        }
        function aB(aH) {
            g();
            if (af(aH)) {
                O(aH)
            }
            return {
                c: {
                    f: U,
                    a: [aH]
                },
                n: {
                    f: I,
                    a: [aH],
                    e: V,
                    ea: [aH]
                }
            }
        }
        this.Submit = aB;
        function V(aK, aH) {
            if (aK.hasMessages()) {
                var aJ = aK.getStatus();
                for (var aI = 0; aI < aK.mArg.length; aI++) {
                    if (aJ[aI].n == 307 || aJ[aI].n == 326 || aJ[aI].n == 9424) {
                        if (aI == 0) {
                            this.highlightedFlds = []
                        }
                        var aL = parseInt(aJ[aI].a);
                        if (F(aH, aL) instanceof DataField && F(aH, aL).GVis()) {
                            F(aH, aL).HighlightBorder()
                        }
                    }
                }
            }
            throw aK
        }
        function U(aH) {
            HidePromptBar();
            return ExecuteWorkflow(aH, 4)
        }
        this.highlightedFlds = [];
        this.ClearHighlight = H;
        this.HandleException = V;
        function H(aH) {
            if (getStateMgr_NS(aH).highlightedFlds.length > 0) {
                for (var aI = 0; aI < getStateMgr_NS(aH).highlightedFlds.length; aI++) {
                    F(aH, getStateMgr_NS(aH).highlightedFlds[aI]).RemoveHighlightBorder()
                }
            }
        }
        function I(aH) {
            H(aH);
            var aJ = Field_BuildList(aH, new FieldList(aH), true, false, true, true, true, true);
            var aI = aJ.Push({
                qual: ""
            },
            ARKWGetStringByIdx(aH, 7), ARKWGetStringByIdx(aH, 6), 6, 4, false, true);
            var aK = {
                n: {
                    f: av,
                    a: [aH]
                }
            };
            if (ARPrefsGetAsNumber(20109) == 1) {
                aK.c = {
                    f: function() {
                        getCurWFC_NS(aH).setStatus(getLocalizedMessage("Submit Successful: ID = {0}", [getForm_NS(aH).reqIdStr]));
                        Z(aH);
                        var aL = promptBar.msgTypeToSysMsgDest(promptBar.ARTypetoPromptType(0));
                        var aM = {
                            t: 0,
                            m: getLocalizedMessage(9504, [getForm_NS(aH).reqIdStr]),
                            n: 9504,
                            a: null
                        };
                        return WC_DisplayMessage(aH, [{
                            mstat: aM,
                            msgloc: aL
                        }])
                    }
                }
            } else {
                aK.c = {
                    f: function() {
                        getCurWFC_NS(aH).setStatus(getLocalizedMessage("Submit Successful: ID = {0}", [getForm_NS(aH).reqIdStr]));
                        Z(aH)
                    }
                }
            }
            if (aI) {
                return {
                    c: {
                        t: aI,
                        f: function() {
                            return {
                                c: aI.c,
                                n: aI.n
                            }
                        }
                    },
                    n: {
                        f: function() {
                            return {
                                c: aK.c,
                                n: aK.n
                            }
                        }
                    }
                }
            } else {
                return aK
            }
        }
        function av(aH) {
            if (ARPrefsGetAsNumber(20101) != 2 && ao != null) {
                ao.Restore()
            }
            var aI = AREventFunction(aH, 4096);
            if (aI) {
                if (typeof getForm_NS(aH).entry != "undefined") {
                    Field_LoadEntry(aH, getForm_NS(aH).entry, true, false, getForm_NS(aH).reqIdStr)
                }
                if (ARPrefsGetAsNumber(28515) != 1) {
                    return {
                        c: {
                            f: ExecuteWorkflow,
                            a: [aH, aI]
                        },
                        n: {
                            f: G,
                            a: [aH]
                        }
                    }
                }
            }
            return {
                n: {
                    f: G,
                    a: [aH]
                }
            }
        }
        function G(aH) {
            if (ARPrefsGetAsNumber(28515) == 1) {
                return {
                    n: {
                        t: getStateMgr_NS(aH),
                        f: getStateMgr_NS(aH).ARStateChange,
                        a: [aH, 5]
                    }
                }
            }
            switch (ARPrefsGetAsNumber(20101)) {
            case 1:
                return {
                    c:
                    {
                        f:
                        aq,
                        a: [aH, true]
                    },
                    n: {
                        f: function() {
                            ExecuteWorkflow(aH, 262144);
                            Z(aH)
                        }
                    }
                };
            case 2:
                for (ii in getForm_NS(aH).systemFields) {
                    F(aH, ii).Clear()
                }
                Z(aH);
                break;
            case 0:
                p(aH, true);
                break
            }
            return function() {
                ExecuteWorkflow(aH, 262144);
                Z(aH)
            }
        }
        function ak(aH) {
            H(aH);
            g();
            if (af(aH)) {
                O(aH)
            }
            if ((getARStateCurrent_NS(aH) == 5)) {
                return {
                    c: {
                        f: w,
                        a: [aH]
                    },
                    n: {
                        f: aa,
                        a: [aH],
                        e: V,
                        ea: [aH]
                    }
                }
            } else {
                return {
                    n: {
                        f: au,
                        a: [aH],
                        e: V,
                        ea: [aH]
                    }
                }
            }
        }
        this.Modify = ak;
        function w(aH) {
            HidePromptBar();
            return ExecuteWorkflow(aH, 8)
        }
        function aa(aH) {
            var aP = Field_BuildList(aH, new FieldList(aH), true, true, false, false, true, false);
            var aQ = false;
            for (var aL in aP.mFields) {
                aQ = true;
                break
            }
            if (!aQ) {
                return {
                    n: {
                        f: v,
                        a: [aH]
                    }
                }
            }
            var aM = [getDBSnapshot_NS(aH).GetDataForID(1).toString()];
            var aN = getDBSnapshot_NS(aH).ts;
            var aJ = {};
            var aO = aP.PushEntry(ARKWGetStringByIdx(aH, 7), ARKWGetStringByIdx(aH, 6), aM, aN, aJ, true);
            if (ShowWaitCursor()) {
                return {
                    isFromFunctionSplit: 1,
                    c: {
                        t: aO,
                        f: function() {
                            return {
                                c: aO.c,
                                n: aO.n
                            }
                        }
                    },
                    n: {
                        f: function() {
                            var aS = aJ.req.result;
                            if (aS.n == 0) {
                                var aS = {};
                                return {
                                    c: {
                                        f: ConfirmPopup,
                                        a: [aH, WorkflowContext_StatusToString(aH, [{
                                            n: 9299,
                                            t: 1,
                                            m: null,
                                            a: null
                                        }]), aS, 8 | 4]
                                    },
                                    n: {
                                        f: function() {
                                            if (("v" in aS.result) && aS.result.v == 1) {
                                                var aU = {};
                                                var aV = aP.PushEntry(ARKWGetStringByIdx(aH, 7), ARKWGetStringByIdx(aH, 6), aM, 0, aU, true);
                                                if ("c" in aV) {
                                                    return {
                                                        isFromFunctionSplit: 1,
                                                        c: {
                                                            t: aV,
                                                            f: function() {
                                                                return {
                                                                    c: aV.c,
                                                                    n: aV.n
                                                                }
                                                            }
                                                        },
                                                        n: {
                                                            f: v,
                                                            a: [aH]
                                                        }
                                                    }
                                                } else {
                                                    return {
                                                        n: {
                                                            f: v,
                                                            a: [aH]
                                                        }
                                                    }
                                                }
                                            } else {
                                                return
                                            }
                                        }
                                    }
                                }
                            } else {
                                if (aS.n == -1) {
                                    var aT = {
                                        n: 302,
                                        t: 2,
                                        m: aS.m,
                                        a: null
                                    };
                                    var aR = promptBar.msgTypeToSysMsgDest(promptBar.ARTypetoPromptType(2));
                                    return {
                                        c: {
                                            f: WC_DisplayMessage,
                                            a: [aH, [{
                                                mstat: aT,
                                                msgloc: aR
                                            }]]
                                        },
                                        n: {
                                            f: function() {
                                                if (1020 in getFields_NS(aH)) {
                                                    Field_ClearChanged(aH);
                                                    return getFields_NS(aH)[1020].Refresh(0, 0, false)
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            return {
                                n: {
                                    f: v,
                                    a: [aH]
                                }
                            }
                        }
                    }
                }
            } else {
                if (aO.n == 0) {
                    var aO = {};
                    return {
                        c: {
                            f: ConfirmPopup,
                            a: [aH, WorkflowContext_StatusToString(aH, [{
                                n: 9299,
                                t: 1,
                                m: null,
                                a: null
                            }]), aO, 8 | 4]
                        },
                        n: {
                            f: function() {
                                if (("v" in aO.result) && aO.result.v == 1) {
                                    var aR = {};
                                    aP.PushEntry(ARKWGetStringByIdx(aH, 7), ARKWGetStringByIdx(aH, 6), aM, 0, aR, true);
                                    return {
                                        n: {
                                            f: v,
                                            a: [aH]
                                        }
                                    }
                                } else {
                                    return
                                }
                            }
                        }
                    }
                } else {
                    if (aO.n == -1) {
                        var aK = {
                            n: 302,
                            t: 2,
                            m: aO.m,
                            a: null
                        };
                        var aI = promptBar.msgTypeToSysMsgDest(promptBar.ARTypetoPromptType(2));
                        return {
                            c: {
                                f: WC_DisplayMessage,
                                a: [aH, [{
                                    mstat: aK,
                                    msgloc: aI
                                }]]
                            },
                            n: {
                                f: function() {
                                    if (1020 in getFields_NS(aH)) {
                                        Field_ClearChanged(aH);
                                        return getFields_NS(aH)[1020].Refresh(0, 0, false)
                                    }
                                }
                            }
                        }
                    }
                }
                return {
                    n: {
                        f: v,
                        a: [aH]
                    }
                }
            }
        }
        function v(aH) {
            Z(aH);
            h(aH);
            getCurWFC_NS(aH).setStatus(getLocalizedMessage("Modify Successful"));
            return {
                c: {
                    f: ad,
                    a: [aH]
                },
                n: {
                    f: Z,
                    a: [aH]
                }
            }
        }
        function h(aH) {
            var aJ = getFields_NS(aH)[1020];
            for (var aI in aJ.mLastRowSelections) {
                var aK = aJ.FishOutTR(parseInt(aI));
                aK.style.fontStyle = "italic"
            }
        }
        function au(aI) {
            var aM = Field_BuildList(aI, new FieldList(aI), true, false, true, false, true, false);
            var aL = getFields_NS(aI)[1020];
            var aH = [];
            for (var aK in aL.mLastRowSelections) {
                aH.push(aL.TagFromRowNo(parseInt(aK)))
            }
            var aN;
            if (aH.length == 1) {
                aN = getLocalizedMessage("This operation will modify 1 entry. Continue?")
            } else {
                aN = getLocalizedMessage("This operation will modify {0} entries. Continue?", [aH.length])
            }
            var aJ = {};
            return {
                c: {
                    f: ConfirmPopup,
                    a: [aI, aN, aJ, 4 | 8]
                },
                n: {
                    f: function() {
                        if ("v" in aJ.result && aJ.result.v == 1) {
                            Z(aI);
                            var aP = {};
                            var aO = aM.PushEntry(ARKWGetStringByIdx(aI, 7), ARKWGetStringByIdx(aI, 6), aH, 0, aP, false);
                            h(aI);
                            if (ShowWaitCursor()) {
                                return {
                                    isFromFunctionSplit: 1,
                                    c: {
                                        t: aO,
                                        f: function() {
                                            return {
                                                c: aO.c,
                                                n: aO.n
                                            }
                                        }
                                    },
                                    n: {
                                        f: N,
                                        a: [aI, aH.length]
                                    }
                                }
                            } else {
                                N(aI, aH.length)
                            }
                        }
                    }
                }
            }
        }
        function N(aH, aI) {
            if (aI == 1) {
                msg = getLocalizedMessage("1 entry modified")
            } else {
                msg = getLocalizedMessage("{0} entries modified", [aI])
            }
            getCurWFC_NS(aH).setStatus(msg)
        }
        function ad(aH) {
            if (getForm_NS(aH).entry) {
                Field_LoadEntry(aH, getForm_NS(aH).entry, false, false, getForm_NS(aH).reqIdStr)
            }
            return ExecuteWorkflow(aH, 2048)
        }
        function ar(aH) {
            if ("TbSave" in getForm_NS(aH)) {
                return getForm_NS(aH).TbSave
            } else {
                return (1001 in getFields_NS(aH))
            }
        }
        this.IsSaveAllowed = ar
    };
    setStateMgr_NS(d, b)
}
function ExecuteWorkflow(d, b, f) {
    if (typeof b == "number") {
        b = AREventFunction(d, b, f)
    }
    if (b) {
        return getCurWFC_NS(d).execute({
            t: b.h,
            f: b.f,
            a: [d]
        })
    }
}
var MessageTypes = {
    1 : {
        i: "exclamation",
        m: getLocalizedMessage("BMC Remedy User - Warning")
    },
    0 : {
        i: "info",
        m: getLocalizedMessage("BMC Remedy User - Note")
    },
    2 : {
        i: "error",
        m: getLocalizedMessage("BMC Remedy User - Error")
    },
    3 : {
        i: "error",
        m: getLocalizedMessage("BMC Remedy User - Error")
    }
};
function MessagePopup(d, b) {
    var f = WorkflowContext_StatusToString(d, b);
    return weOpenModalPopup(d, (AbsContextPath + "resources/html/MessagePopup.html"), "Message", {
        title: MessageTypes[b[0].t].m,
        status: b,
        msg: f,
        image: MessageTypes[b[0].t].i,
        btn: 2,
        appss: GetAppStyleSheet("../../"),
        acc: 0
    },
    {},
    [380, 170])
}
function ConfirmPopup(b, g, d, f) {
    return weOpenModalPopup(b, (AbsContextPath + "resources/html/MessagePopup.html"), "Confirm", {
        title: getLocalizedMessage("Confirm Save Request"),
        image: "exclamation",
        status: null,
        msg: g,
        btn: f,
        appss: GetAppStyleSheet("../../"),
        acc: 0
    },
    d, [380, 170])
}
function AccTooltip(b, d) {}
var PREFS;
function ARPrefsReplaceAll(b) {
    PREFS = b
}
function ARPrefsGetAsString(b) {
    if (! (b in PREFS)) {
        return null
    }
    return PREFS[b]
}
function ARPrefsSetAsString(d, b) {
    PREFS[d] = b
}
function ARPrefsGetAsNumber(d) {
    if (! (d in PREFS)) {
        return null
    }
    var b = PREFS[d];
    return parseInt(b)
}
function ARPrefsSetAsNumber(d, b) {
    PREFS[d] = b + ""
}
function ARPrefsSetAsNull(b) {
    PREFS[b] = null
}
function ARPrefsSet(b, h, d, g) {
    if (!d) {
        d = ""
    }
    if (!g) {
        g = ""
    }
    var f = new NDXSetARUserPreference(b, h, d, g);
    return f.result
}
var VP;
function ARPrefsGet(b, k, d) {
    if (! (k in PREFS)) {
        if (!d) {
            d = ""
        }
        var f = new NDXGetARUserPreference(b, k, d)
    }
    var h = PREFS[k];
    if (d && h) {
        h = h.toString();
        VP = new RegExp(d + "=([^\n]*)\n", "m");
        var g = h.match(VP);
        h = g[1]
    }
    return h
}
function ARPrefsRefresh(d, b) {
    new NDXRefreshARUserPreferences(d, b)
}
NDXRequest.prototype.constructor = NDXRequest;
function GET_XML_HTTP() {
    var d;
    try {
        d = new XMLHttpRequest()
    } catch(b) {
        try {
            d = new ActiveXObject("Msxml2.XMLHTTP")
        } catch(b) {
            try {
                d = new ActiveXObject("Microsoft.XMLHTTP")
            } catch(b) {}
        }
    }
    return d
}
function NDXRequest(b) {
    if (arguments.length) {
        this.init(b)
    }
}
function MarshallArgs(p) {
    var u = [];
    u.push("/");
    u.push(p[0]);
    u.push("/");
    var b = {
        string: function(v, w) {
            v.push(w.length);
            v.push("/");
            v.push(w)
        },
        "boolean": function(v, w) {
            v.push("1");
            v.push("/");
            v.push(w ? "1": "0")
        },
        number: function(v, y) {
            var w = "" + y;
            v.push("" + w.length);
            v.push("/");
            v.push(w)
        }
    };
    for (var k = 1; k < p.length; ++k) {
        var s = p[k];
        if (s instanceof Array) {
            var d = s.length;
            var o = [];
            o.push(d);
            o.push("/");
            if (d > 0) {
                var q = b[typeof s[0]];
                for (var h = 0; h < d; ++h) {
                    q(o, s[h])
                }
            }
            var g = o.join("");
            b.string(u, g)
        } else {
            b[typeof s](u, s)
        }
    }
    var f = u.join("");
    f = (f.length - 1) + f;
    return f
}
NDXRequest.XMLHTTPOpen = function(f, g, h, d, b) {
    if (!xmlHttpGET || (xmlHttpGET && ((g.length + h.length + d.length) > 2047))) {
        f.open("POST", g, b);
        return true
    } else {
        f.open("GET", g + h + d, b);
        return false
    }
};
NDXRequest.prototype.windowID = null;
NDXRequest.prototype.init = function() {
    var windowID = this.windowID = arguments[1];
    var finalbuff = MarshallArgs(arguments);
    var retry = false;
    do {
        var fetchedviaapplet = false,
        response;
        if (document.applets.PostApplet) {
            var postapp = document.applets.PostApplet;
            try {
                response = "" + postapp.doPost((AbsContextPath + "BackChannel"), "text/plain; charset=UTF-8", finalbuff, document.cookie);
                if (typeof response == "string" && response.length > 0) {
                    if (response.charAt(0) == "1") {
                        fetchedviaapplet = true
                    }
                }
            } catch(e) {}
        }
        if (fetchedviaapplet) {
            eval(response.substr(1))
        } else {
            var fetcher;
            fetcher = GET_XML_HTTP();
            var finalbuffuri;
            if (!retry) {
                finalbuffuri = encodeURIComponent(finalbuff)
            } else {
                retry = false
            }
            var ctxtpath = (AbsContextPath + "BackChannel/"),
            param = "?param=";
            var isPOST = NDXRequest.XMLHTTPOpen(fetcher, ctxtpath, param, finalbuffuri, false);
            if (!isPOST) {
                finalbuff = null
            }
            fetcher.setRequestHeader("Content-type", "text/plain; charset=UTF-8");
            try {
                var d = new Date();
                if (logTimings) {
                    LogWrite("&lt;HTTP&gt; /* " + FormatDate(d) + " */+HTTP call", true)
                }
                fetcher.send(finalbuff)
            } catch(e) {
                getCurWFC_NS(this.windowID).status(9351)
            }
            var d = new Date();
            if (fetcher.readyState == 4 && fetcher.status == 200 && fetcher.responseText) {
                if (fetcher.responseText.indexOf(9201) == -1) {
                    initSessionTimeoutCounter()
                }
                if (fetcher.responseText.indexOf("this.result=") == -1 && fetcher.responseText.indexOf("getCurWFC_NS(this.windowID).status") == -1 && fetcher.responseText.indexOf("retry=") == -1) {
                    LogAndAlert(getLocalizedMessage(9421, null, null));
                    throw new WorkflowException(this.windowID, 0, [])
                } else {
                    eval(fetcher.responseText);
                    if (logTimings) {
                        LogWrite("&lt;HTTP&gt; /* " + FormatDate(d) + " */-HTTP call", true)
                    }
                }
            } else {
                getCurWFC_NS(this.windowID).status(9351)
            }
        }
    } while ( retry )
};
NDXRequest.prototype.result = null;
NDXRequest.prototype.GetResult = function() {
    return this.result
};
NDXRequest.prototype.Override = function(f) {
    var b = confirm(WorkflowContext_StatusToString(this.windowID, f) + "\n" + getLocalizedMessage("Do you wish to override?"));
    if (b == false) {
        throw new WorkflowException(this.windowID, 0, [])
    }
    var d = new NDXSetOverride(this.windowID, true);
    return true
};
NDXRequest.prototype.fetcher = null;
NDXRequest.prototype.AsyncBC = function() {
    var finalbuff = MarshallArgs(arguments);
    this.finalbuff = finalbuff;
    var retry = false;
    do {
        var fetchedviaapplet = false,
        response;
        if (document.applets.PostApplet) {
            var postapp = document.applets.PostApplet;
            try {
                response = "" + postapp.doPost((AbsContextPath + "BackChannel"), "text/plain; charset=UTF-8", finalbuff, document.cookie);
                if (typeof response == "string" && response.length > 0) {
                    if (response.charAt(0) == "1") {
                        fetchedviaapplet = true
                    }
                }
            } catch(e) {}
        }
        if (fetchedviaapplet) {
            eval(response.substr(1))
        } else {
            this.fetcher = GET_XML_HTTP();
            var finalbuffuri;
            if (!retry) {
                finalbuffuri = encodeURIComponent(finalbuff)
            } else {
                retry = false
            }
            var ctxtpath = (AbsContextPath + "BackChannel/"),
            param = "?param=";
            var isPOST = NDXRequest.XMLHTTPOpen(this.fetcher, ctxtpath, param, finalbuffuri, true);
            if (!isPOST) {
                finalbuff = null
            }
            var caller = this;
            this.fetcher.onreadystatechange = function() {
                caller.AsyncBCCallback.call(caller)
            };
            this.fetcher.setRequestHeader("Content-type", "text/plain; charset=UTF-8");
            try {
                var d = new Date();
                if (logTimings) {
                    LogWrite("&lt;HTTP&gt; /* " + FormatDate(d) + " */+HTTP call", true)
                }
                this.fetcher.send(finalbuff);
                caller.fetcher = this.fetcher
            } catch(e) {
                getCurWFC_NS(this.windowID).status(9351)
            }
        }
    } while ( retry )
};
NDXRequest.prototype.RunningSign = null;
NDXRequest.prototype.showRunning = function() {
    var d = document.createElement("DIV");
    d.style.align = "center";
    d.style.valign = "center";
    d.style.position = "relative";
    d.style.left = "50%";
    d.style.top = "50%";
    d.style.visibility = "visible";
    d.style.display = "inline";
    d.style.zIndex = nextZIndex + 1;
    if (typeof WaitCursorInnerHTML != "undefined") {
        var b = WaitCursorInnerHTML.replace(/imageContextPath/, AbsContextPath + "shared/images");
        var h = b.indexOf("</img>");
        var g = b.slice(0, h + 6);
        var f = b.slice(h + 6, b.length);
        d.innerHTML = g + getLocalizedMessage(f)
    } else {
        d.innerHTML = "<img src=" + AbsContextPath + "resources/images/Progress_NonModal-circle.gif></img>" + getLocalizedMessage("Loading...")
    }
    document.body.style.cursor = "wait";
    document.body.appendChild(d);
    this.RunningSign = d
};
NDXRequest.prototype.hideRunning = function() {
    document.body.style.cursor = "auto";
    document.body.removeChild(this.RunningSign)
};
GlobalShowRunning = function() {
    var b = null;
    if (ShowWaitCursor()) {
        b = new NDXRequest();
        if (!b.RunningSign) {
            b.showRunning()
        }
    }
    return b
};
NDXRequest.prototype.redirectPassword = function(b, d, f) {
    Field_ClearChanged(this.windowID);
    if (getCurWFC_NS(this.windowID) != null) {
        getCurWFC_NS(this.windowID).pushEntryIntoCurrentStack({
            a: [b],
            f: function(g) {
                var h = allocWindowID_NS();
                weOpen(h, this.windowID, g, "_self", "", null, null, true, false);
                throw new WorkflowException(this.windowID, 0, [])
            }
        });
        getCurWFC_NS(this.windowID).pushEntryIntoCurrentStack({
            f: ARACTMessage,
            a: [this.windowID, 0, f, false, d]
        })
    }
};
NDXRequest.prototype.AsyncBCCallback = function() {
    if (this.fetcher.readyState == 4) {
        var theText;
        var d = new Date();
        if (this.fetcher.status == 200 && this.fetcher.responseText) {
            if (this.fetcher.responseText.indexOf("this.result=") == -1 && this.fetcher.responseText.indexOf("getCurWFC_NS(this.windowID).status") == -1 && this.fetcher.responseText.indexOf("retry=") == -1) {
                LogAndAlert(getLocalizedMessage(9421, null, null));
                throw new WorkflowException(this.windowID, 0, [])
            } else {
                theText = this.fetcher.responseText
            }
        } else {
            theText = "getCurWFC_NS(" + this.windowID + ").status([{n:" + 9351 + ",t:1,m:null,a:null}]);throw new WorkflowException(" + this.windowID + ", 0, []);"
        }
        weEnableStuff(this.windowID);
        this.hideRunning();
        getCurWFC_NS(this.windowID).pushEntryIntoCurrentStack({
            t: this,
            a: [d],
            f: function(d) {
                if (theText.indexOf(9201) == -1) {
                    initSessionTimeoutCounter()
                }
                eval(theText);
                if (logTimings) {
                    LogWrite("&lt;HTTP&gt; /* " + FormatDate(d) + " */-HTTP call", true)
                }
                if ((typeof retry != "undefined") && retry) {
                    retry = false;
                    var fetcher;
                    fetcher = GET_XML_HTTP();
                    var finalbuff = this.finalbuff;
                    var finalbuffuri = encodeURIComponent(finalbuff);
                    var ctxtpath = (AbsContextPath + "BackChannel/"),
                    param = "?param=";
                    var isPOST = NDXRequest.XMLHTTPOpen(fetcher, ctxtpath, param, finalbuffuri, false);
                    if (!isPOST) {
                        finalbuff = null
                    }
                    fetcher.setRequestHeader("Content-type", "text/plain; charset=UTF-8");
                    try {
                        var d = new Date();
                        if (logTimings) {
                            LogWrite("&lt;HTTP&gt; /* " + FormatDate(d) + " */+HTTP call", true)
                        }
                        fetcher.send(finalbuff)
                    } catch(e) {
                        getCurWFC_NS(this.windowID).status(9351)
                    }
                    var d = new Date();
                    if (fetcher.readyState == 4 && fetcher.status == 200 && fetcher.responseText) {
                        if (fetcher.responseText.indexOf(9201) == -1) {
                            initSessionTimeoutCounter()
                        }
                        if (fetcher.responseText.indexOf("this.result=") == -1 && fetcher.responseText.indexOf("getCurWFC_NS(this.windowID).status") == -1 && fetcher.responseText.indexOf("retry=") == -1) {
                            LogAndAlert(getLocalizedMessage(9421, null, null));
                            throw new WorkflowException(this.windowID, 0, [])
                        } else {
                            eval(fetcher.responseText);
                            if (logTimings) {
                                LogWrite("&lt;HTTP&gt; /* " + FormatDate(d) + " */-HTTP call", true)
                            }
                        }
                    } else {
                        getCurWFC_NS(this.windowID).status(9351)
                    }
                }
            }
        });
        this.fetcher.onreadystatechange = function() {};
        this.fetcher = null;
        getCurWFC_NS(this.windowID).resume()
    }
};
NDXRequest.prototype.SendAsync = function() {
    var h = MarshallArgs(arguments);
    this.finalbuff = h;
    var b = false;
    do {
        this.fetcher = GET_XML_HTTP();
        var k;
        if (!b) {
            k = encodeURIComponent(h)
        } else {
            b = false
        }
        var q = (AbsContextPath + "BackChannel/"), g = "?param=";
        var s = NDXRequest.XMLHTTPOpen(this.fetcher, q, g, k, true);
        if (!s) {
            h = null
        }
        var f = this;
        this.fetcher.onreadystatechange = function() {};
        this.fetcher.setRequestHeader("Content-type", "text/plain; charset=UTF-8");
        try {
            var p = new Date();
            if (logTimings) {
                LogWrite("&lt;HTTP&gt; /* " + FormatDate(p) + " */+HTTP call", true)
            }
            this.fetcher.send(h);
            f.fetcher = this.fetcher
        } catch(o) {
            getCurWFC_NS(this.windowID).status(9351)
        }
    } while ( b )
};
NDXGetEntryList.prototype = new NDXRequest();
NDXGetEntryList.prototype.constructor = NDXGetEntryList;
NDXGetEntryList.superclass = NDXRequest.prototype;
function NDXGetEntryList(y, h, k, b, f, g, p, u, s, w, B, d, A, v, q, o) {
    if (arguments.length) {
        this.init("GetEntryList", y, h, k, b, f, g, p, u, s, w, B, d, A, v, q, o)
    }
}
NDXSetEntryList.prototype = new NDXRequest();
NDXSetEntryList.prototype.constructor = NDXSetEntryList;
NDXSetEntryList.superclass = NDXRequest.prototype;
function NDXSetEntryList(p, E, D, w, u, o, C, b, f, h, B, d, s, v, k, A, g, y, q) {
    if (arguments.length) {
        this.init("SetEntryList", p, E, D, w, u, o, C, b, f, h, B, d, s, v, k, A, g, y, q)
    }
}
NDXGetEntry.prototype = new NDXRequest();
NDXGetEntry.prototype.constructor = NDXGetEntry;
NDXGetEntry.superclass = NDXRequest.prototype;
function NDXGetEntry(f, p, h, g, o, d, b, k) {
    if (arguments.length) {
        this.init("GetEntry", f, p, h, g, o, d, b, k)
    }
}
NDXSetEntry.prototype = new NDXRequest();
NDXSetEntry.prototype.constructor = NDXSetEntry;
NDXSetEntry.superclass = NDXRequest.prototype;
function NDXSetEntry(s, f, g, u, h, o, k, p, q, b, d) {
    if (arguments.length) {
        this.init("SetEntry", s, f, g, u, h, o, k, p, q, b, d)
    }
}
NDXGetSQLEntryList.prototype = new NDXRequest();
NDXGetSQLEntryList.prototype.constructor = NDXGetSQLEntryList;
NDXGetSQLEntryList.superclass = NDXRequest.prototype;
function NDXGetSQLEntryList(w, g, h, f, v, k, d, b, q, u, p, s, o) {
    if (arguments.length) {
        this.init("GetSQLEntryList", w, g, h, f, v, k, d, b, q, u, p, s, o)
    }
}
NDXDeleteEntry.prototype = new NDXRequest();
NDXDeleteEntry.prototype.constructor = NDXDeleteEntry;
NDXDeleteEntry.superclass = NDXRequest.prototype;
function NDXDeleteEntry(d, g, f, b) {
    if (arguments.length) {
        this.init("DeleteEntry", d, g, f, b)
    }
}
NDXCompileQualification.prototype = new NDXRequest();
NDXCompileQualification.prototype.constructor = NDXCompileQualification;
NDXCompileQualification.superclass = NDXRequest.prototype;
function NDXCompileQualification(b, h, f, g, d) {
    if (arguments.length) {
        this.init("CompileQualification", b, h, f, g, d)
    }
}
NDXCompileExternalQualification.prototype = new NDXRequest();
NDXCompileExternalQualification.prototype.constructor = NDXCompileExternalQualification;
NDXCompileExternalQualification.superclass = NDXRequest.prototype;
function NDXCompileExternalQualification(o, d, f, b, p, q, h, g, k, s) {
    if (arguments.length) {
        this.init("CompileExternalQualification", o, d, f, b, p, q, h, g, k, s)
    }
}
NDXServerRunProcess.prototype = new NDXRequest();
NDXServerRunProcess.prototype.constructor = NDXServerRunProcess;
NDXServerRunProcess.superclass = NDXRequest.prototype;
function NDXServerRunProcess(s, f, g, u, o, d, b, k, h, q, v, p) {
    if (arguments.length) {
        this.init("ServerRunProcess", s, f, g, u, o, d, b, k, h, q, v, p)
    }
}
NDXExpandMenu.prototype = new NDXRequest();
NDXExpandMenu.prototype.constructor = NDXExpandMenu;
NDXExpandMenu.superclass = NDXRequest.prototype;
function NDXExpandMenu(o, E, w, u, B, y, D, p, v, s, d, f, h, C, k, A, g, b, q) {
    if (arguments.length) {
        this.init("ExpandMenu", o, E, w, u, B, y, D, p, v, s, d, f, h, C, k, A, g, b, q)
    }
}
NDXGetMenuDefinition.prototype = new NDXRequest();
NDXGetMenuDefinition.prototype.constructor = NDXGetMenuDefinition;
NDXGetMenuDefinition.superclass = NDXRequest.prototype;
function NDXGetMenuDefinition(b, d, f) {
    if (arguments.length) {
        this.init("GetMenuDefinition", b, d, f)
    }
}
NDXGetARUserPreference.prototype = new NDXRequest();
NDXGetARUserPreference.prototype.constructor = NDXGetARUserPreference;
NDXGetARUserPreference.superclass = NDXRequest.prototype;
function NDXGetARUserPreference(d, b, f) {
    if (arguments.length) {
        this.init("GetARUserPreference", d, b, f)
    }
}
NDXSetARUserPreference.prototype = new NDXRequest();
NDXSetARUserPreference.prototype.constructor = NDXSetARUserPreference;
NDXSetARUserPreference.superclass = NDXRequest.prototype;
function NDXSetARUserPreference(d, b, g, f) {
    if (arguments.length) {
        this.init("SetARUserPreference", d, b, g, f)
    }
}
NDXRefreshARUserPreferences.prototype = new NDXRequest();
NDXRefreshARUserPreferences.prototype.constructor = NDXRefreshARUserPreferences;
NDXRefreshARUserPreferences.superclass = NDXRequest.prototype;
function NDXRefreshARUserPreferences(d, b) {
    if (arguments.length) {
        this.init("RefreshARUserPreferences", d, b)
    }
}
NDXGetURLForForm.prototype = new NDXRequest();
NDXGetURLForForm.prototype.constructor = NDXGetURLForForm;
NDXGetURLForForm.superclass = NDXRequest.prototype;
function NDXGetURLForForm(g, p, o, k, d, b, f, h) {
    if (arguments.length) {
        this.init("GetURLForForm", g, p, o, k, d, b, f, h)
    }
}
NDXGetTableEntryList.prototype = new NDXRequest();
NDXGetTableEntryList.prototype.constructor = NDXGetTableEntryList;
NDXGetTableEntryList.superclass = NDXRequest.prototype;
function NDXGetTableEntryList(q, w, u, D, k, A, y, v, s, C, B, E, b, f, p, g, o, d, h) {
    if (arguments.length) {
        this.init("GetTableEntryList", q, w, u, D, k, A, y, v, s, C, B, E, b, f, p, g, o, d, h)
    }
}
NDXGetQBETableEntryList.prototype = new NDXRequest();
NDXGetQBETableEntryList.prototype.constructor = NDXGetQBETableEntryList;
NDXGetQBETableEntryList.superclass = NDXRequest.prototype;
function NDXGetQBETableEntryList(s, C, y, N, h, G, D, A, w, L, J, o, u, v, O, K, p, I, E, b, f, q, k, H, B, d, g) {
    if (arguments.length) {
        this.init("GetQBETableEntryList", s, C, y, N, h, G, D, A, w, L, J, o, u, v, O, K, p, I, E, b, f, q, k, H, B, d, g)
    }
}
NDXGetGuideServerAndForm.prototype = new NDXRequest();
NDXGetGuideServerAndForm.prototype.constructor = NDXGetGuideServerAndForm;
NDXGetGuideServerAndForm.superclass = NDXRequest.prototype;
function NDXGetGuideServerAndForm(b, d, f) {
    if (arguments.length) {
        this.init("GetGuideServerAndForm", b, d, f)
    }
}
NDXGetCurrencyExchangeRates.prototype = new NDXRequest();
NDXGetCurrencyExchangeRates.prototype.constructor = NDXGetCurrencyExchangeRates;
NDXGetCurrencyExchangeRates.superclass = NDXRequest.prototype;
function NDXGetCurrencyExchangeRates(b, f, d) {
    if (arguments.length) {
        this.init("GetCurrencyExchangeRates", b, f, d)
    }
}
NDXGetPushFieldTypes.prototype = new NDXRequest();
NDXGetPushFieldTypes.prototype.constructor = NDXGetPushFieldTypes;
NDXGetPushFieldTypes.superclass = NDXRequest.prototype;
function NDXGetPushFieldTypes(b, g, f, d) {
    if (arguments.length) {
        this.init("GetPushFieldTypes", b, g, f, d)
    }
}
NDXGetServerTimestamp.prototype = new NDXRequest();
NDXGetServerTimestamp.prototype.constructor = NDXGetServerTimestamp;
NDXGetServerTimestamp.superclass = NDXRequest.prototype;
function NDXGetServerTimestamp(b, d) {
    if (arguments.length) {
        this.init("GetServerTimestamp", b, d)
    }
}
NDXMarkAlert.prototype = new NDXRequest();
NDXMarkAlert.prototype.constructor = NDXMarkAlert;
NDXMarkAlert.superclass = NDXRequest.prototype;
function NDXMarkAlert(b, h, f, d, g) {
    if (arguments.length) {
        this.init("MarkAlert", b, h, f, d, g)
    }
}
NDXParseAndEncodeQualifier.prototype = new NDXRequest();
NDXParseAndEncodeQualifier.prototype.constructor = NDXParseAndEncodeQualifier;
NDXParseAndEncodeQualifier.superclass = NDXRequest.prototype;
function NDXParseAndEncodeQualifier(d, h, g, b, f) {
    if (arguments.length) {
        this.init("ParseAndEncodeQualifier", d, h, g, b, f)
    }
}
NDXParseAndEvaluateQualifier.prototype = new NDXRequest();
NDXParseAndEvaluateQualifier.prototype.constructor = NDXParseAndEvaluateQualifier;
NDXParseAndEvaluateQualifier.superclass = NDXRequest.prototype;
function NDXParseAndEvaluateQualifier(g, p, o, b, k, f, d, h) {
    if (arguments.length) {
        this.init("ParseAndEvaluateQualifier", g, p, o, b, k, f, d, h)
    }
}
NDXGetFieldDefaults.prototype = new NDXRequest();
NDXGetFieldDefaults.prototype.constructor = NDXGetFieldDefaults;
NDXGetFieldDefaults.superclass = NDXRequest.prototype;
function NDXGetFieldDefaults(b, g, f, d) {
    if (arguments.length) {
        this.init("GetFieldDefaults", b, g, f, d)
    }
}
NDXSetOverride.prototype = new NDXRequest();
NDXSetOverride.prototype.constructor = NDXSetOverride;
NDXSetOverride.superclass = NDXRequest.prototype;
function NDXSetOverride(b, d) {
    if (arguments.length) {
        this.init("SetOverride", b, d)
    }
}
NDXSaveSearch.prototype = new NDXRequest();
NDXSaveSearch.prototype.constructor = NDXSaveSearch;
NDXSaveSearch.superclass = NDXRequest.prototype;
function NDXSaveSearch(s, b, d, f, p, k, h, q, g, o) {
    if (arguments.length) {
        this.init("SaveSearch", s, b, d, f, p, k, h, q, g, o)
    }
}
NDXDeleteSearch.prototype = new NDXRequest();
NDXDeleteSearch.prototype.constructor = NDXDeleteSearch;
NDXDeleteSearch.superclass = NDXRequest.prototype;
function NDXDeleteSearch(b, g, d, f) {
    if (arguments.length) {
        this.init("DeleteSearch", b, g, d, f)
    }
}
NDXSaveTableSettings.prototype = new NDXRequest();
NDXSaveTableSettings.prototype.constructor = NDXSaveTableSettings;
NDXSaveTableSettings.superclass = NDXRequest.prototype;
function NDXSaveTableSettings(o, f, g, h, p, k, q, d, b) {
    if (arguments.length) {
        this.init("SaveTableSettings", o, f, g, h, p, k, q, d, b)
    }
}
NDXExecuteService.prototype = new NDXRequest();
NDXExecuteService.prototype.constructor = NDXExecuteService;
NDXExecuteService.superclass = NDXRequest.prototype;
function NDXExecuteService(o, f, d, q, b, g, h, p, k) {
    if (arguments.length) {
        this.init("ExecuteService", o, f, d, q, b, g, h, p, k)
    }
}
NDXGetARTemplate.prototype = new NDXRequest();
NDXGetARTemplate.prototype.constructor = NDXGetARTemplate;
NDXGetARTemplate.superclass = NDXRequest.prototype;
function NDXGetARTemplate(b, g, f, d) {
    if (arguments.length) {
        this.init("GetARTemplate", b, g, f, d)
    }
}
NDXGetOpenWindowURL.prototype = new NDXRequest();
NDXGetOpenWindowURL.prototype.constructor = NDXGetOpenWindowURL;
NDXGetOpenWindowURL.superclass = NDXRequest.prototype;
function NDXGetOpenWindowURL(v, g, o, p, s, q, w, y, k, d, u, f, h, b) {
    if (arguments.length) {
        this.init("GetOpenWindowURL", v, g, o, p, s, q, w, y, k, d, u, f, h, b)
    }
}
NDXGetBulkTableEntryList.prototype = new NDXRequest();
NDXGetBulkTableEntryList.prototype.constructor = NDXGetBulkTableEntryList;
NDXGetBulkTableEntryList.superclass = NDXRequest.prototype;
function NDXGetBulkTableEntryList(b, d) {
    if (arguments.length) {
        this.init("GetBulkTableEntryList", b, d)
    }
}
NDXSaveQuickReport.prototype = new NDXRequest();
NDXSaveQuickReport.prototype.constructor = NDXSaveQuickReport;
NDXSaveQuickReport.superclass = NDXRequest.prototype;
function NDXSaveQuickReport(p, b, h, f, g, o, d, k, q) {
    if (arguments.length) {
        this.init("SaveQuickReport", p, b, h, f, g, o, d, k, q)
    }
}
NDXDeleteQuickReport.prototype = new NDXRequest();
NDXDeleteQuickReport.prototype.constructor = NDXDeleteQuickReport;
NDXDeleteQuickReport.superclass = NDXRequest.prototype;
function NDXDeleteQuickReport(b, g, d, f) {
    if (arguments.length) {
        this.init("DeleteQuickReport", b, g, d, f)
    }
}
NDXModifyQuickReport.prototype = new NDXRequest();
NDXModifyQuickReport.prototype.constructor = NDXModifyQuickReport;
NDXModifyQuickReport.superclass = NDXRequest.prototype;
function NDXModifyQuickReport(b, h, g, f, d) {
    if (arguments.length) {
        this.init("ModifyQuickReport", b, h, g, f, d)
    }
}
NDXGetAPITimings.prototype = new NDXRequest();
NDXGetAPITimings.prototype.constructor = NDXGetAPITimings;
NDXGetAPITimings.superclass = NDXRequest.prototype;
function NDXGetAPITimings(d, b) {
    if (arguments.length) {
        this.init("GetAPITimings", d, b)
    }
}
NDXGetHTMLScriptForViewField.prototype = new NDXRequest();
NDXGetHTMLScriptForViewField.prototype.constructor = NDXGetHTMLScriptForViewField;
NDXGetHTMLScriptForViewField.superclass = NDXRequest.prototype;
function NDXGetHTMLScriptForViewField(d, k, g, f, b, h) {
    if (arguments.length) {
        this.init("GetHTMLScriptForViewField", d, k, g, f, b, h)
    }
}
NDXGetOpenWindowQueryVF.prototype = new NDXRequest();
NDXGetOpenWindowQueryVF.prototype.constructor = NDXGetOpenWindowQueryVF;
NDXGetOpenWindowQueryVF.superclass = NDXRequest.prototype;
function NDXGetOpenWindowQueryVF(q, f, g, h, o, k, s, u, p, d, b) {
    if (arguments.length) {
        this.init("GetOpenWindowQueryVF", q, f, g, h, o, k, s, u, p, d, b)
    }
}
ARMap.prototype.constructor = ARMap;
ARMap.MapParametersRE = new RegExp('\\s*([^=\\s;]+)\\s*=((\\s*([^";]+\\"[^"]*\\"[^";]*)*\\s*)|(\\s*\\"(([^"]|(""))*)\\"\\s*)|([^;]*))(;|$)', "g");
function ARMap(b, f, d) {
    this.windowID = b;
    this.mID = f;
    this.mValue = null;
    this.mVals = {};
    this.mLength = 0;
    this.process(d);
    getARMaps_NS(b)[f] = this
}
ARMap.prototype.process = function(d) {
    this.mVals = {};
    this.mLength = 0;
    this.mValue = d;
    var g;
    while (g = ARMap.MapParametersRE.exec(this.mValue)) {
        var b = g[1];
        var f = g[3] ? g[3] : (g[4] ? g[4] : (g[6] ? (g[8] ? g[6].replace(/\"\"/g, '"') : g[6]) : g[9]));
        if (f != null && f != "") {
            this.mVals[b] = f;
            this.mLength++
        }
    }
};
ARMap.prototype.getValue = function(b) {
    if (b == null) {
        return null
    }
    return this.mVals[b]
};
ARMap.prototype.setValue = function(b, d) {
    if (b == null) {
        return
    }
    if (d == null || d == "") {
        if (this.mVals[b] != null) {
            this.mLength--
        }
        delete this.mVals[b];
        return
    }
    if (!this.mVals[b]) {
        this.mLength++
    }
    this.mVals[b] = d;
    this.computeValue()
};
ARMap.prototype.computeValue = function() {
    var d = "";
    for (var b in this.mVals) {
        var f = this.mVals[b];
        d += b;
        d += "=";
        if (f.indexOf(";") != -1) {
            d += '"';
            d += f.replace(/\"/g, '""');
            d += '"'
        } else {
            d += f
        }
        d += ";"
    }
    F(this.windowID, this.mID).DoSet((d == "") ? Null: new CharType(d))
};
ARMap.prototype.size = function() {
    return this.mLength
};
function M(d, f) {
    if (f == null) {
        return null
    }
    var b = (f in getARMaps_NS(d)) ? getARMaps_NS(d)[f] : null;
    if (b == null) {
        b = new ARMap(d, f, F(d, f).G().toString())
    }
    return b
}
ARArray.prototype.constructor = ARArray;
ARArray.ArrayParametersRE = new RegExp('((\\s*([^";]+\\"[^"]*\\"[^";]*)+\\s*)|(\\s*\\"(([^"]|(""))*)\\"\\s*)|([^;]+))(;|$)', "g");
function ARArray(b, f, d) {
    this.windowID = b;
    this.mID = f;
    this.mValue = null;
    this.mVals = [];
    this.process(d);
    getARArrays_NS(b)[f] = this
}
ARArray.prototype.process = function(d) {
    this.mValue = d;
    this.mVals = [];
    var b;
    while (b = ARArray.ArrayParametersRE.exec(this.mValue)) {
        var f = (typeof b[2] != "undefined") ? b[2] : ((typeof b[3] != "undefined") ? b[3] : ((typeof b[5] != "undefined") ? ((typeof b[7] != "undefined") ? b[5].replace(/\"\"/g, '"') : b[5]) : b[8]));
        if (f != null) {
            this.mVals.push(f)
        }
    }
};
ARArray.prototype.getValue = function(b) {
    if (typeof b != "number") {
        if (typeof b == "string") {
            b = parseInt(b);
            if (isNaN(b)) {
                return null
            }
        } else {
            return null
        }
    }
    b--;
    if (b < 0 || b >= this.mVals.length) {
        return null
    }
    return this.mVals[b]
};
ARArray.prototype.computeValue = function() {
    var d = "";
    for (var b = 0; b < this.mVals.length; b++) {
        if (this.mVals[b].indexOf(";") != -1) {
            d += '"';
            d += this.mVals[b].replace(/\"/g, '""');
            d += '"'
        } else {
            d += this.mVals[b]
        }
        d += ";"
    }
    F(this.windowID, this.mID).DoSet((d == "") ? Null: new CharType(d))
};
ARArray.prototype.append = function(b) {
    if (b == null || b == "") {
        return
    }
    this.mVals.push(b);
    this.computeValue()
};
ARArray.prototype.size = function() {
    return this.mVals.length
};
function ARR(b, f) {
    if (f == null) {
        return null
    }
    var d = (f in getARArrays_NS(b)) ? getARArrays_NS(b)[f] : null;
    if (d == null) {
        d = new ARArray(b, f, F(b, f).G().toString())
    }
    return d
}
var pattern_newLn = /\n/g;
var pattern_carRet = /\r/g;
var pattern_carRetNewLn = /\r\n/g;
var const_newLn = "\n";
var const_carRet = "\r";
var const_carRetNewLn = "\r\n";
function ARFuncSilentFail() {
    getCurWFC_NS(getCurrentWindowID_NS()).status(0)
}
function ARFuncUpper(b) {
    if (b.isNull) {
        return b
    }
    return new CharType(b.toString().toUpperCase())
}
function ARFuncLower(b) {
    if (b.isNull) {
        return b
    }
    return new CharType(b.toString().toLowerCase())
}
function ARFuncDate(b) {
    if (b.isNull) {
        return Null
    }
    return new CharType(new TimeType(b.toString()).toString(2))
}
function ARFuncTime(b) {
    if (b.isNull) {
        return Null
    }
    return new CharType(new TimeType(b.toString()).toTOD())
}
function ARFuncMonth(f) {
    if (f.isNull) {
        return Null
    }
    var b = ARDate.parseDateTime(new TimeType(f.toString()).toString());
    return new IntegerType(b.GMonth() + 1)
}
function ARFuncDay(f) {
    if (f.isNull) {
        return Null
    }
    var b = ARDate.parseDateTime(new TimeType(f.toString()).toString());
    return new IntegerType(b.GDate())
}
function ARFuncYear(f) {
    if (f.isNull) {
        return Null
    }
    var b = ARDate.parseDateTime(new TimeType(f.toString()).toString());
    return new IntegerType(b.GYear())
}
function ARFuncWeekday(f) {
    if (f.isNull) {
        return Null
    }
    var b = ARDate.parseDateTime(new TimeType(f.toString()).toString());
    return new IntegerType(b.GDay() + 1)
}
function ARFuncHour(f) {
    if (f.isNull) {
        return Null
    }
    var b = ARDate.parseDateTime(new TimeType(f.toString()).toString());
    return new IntegerType(b.GHour())
}
function ARFuncMinute(f) {
    if (f.isNull) {
        return Null
    }
    var b = ARDate.parseDateTime(new TimeType(f.toString()).toString());
    return new IntegerType(b.GMinute())
}
function ARFuncSecond(f) {
    if (f.isNull) {
        return Null
    }
    var b = ARDate.parseDateTime(new TimeType(f.toString()).toString());
    return new IntegerType(b.GSecond())
}
function ARFuncTrunc(b) {
    return b.TRUNC()
}
function ARFuncRound(b) {
    b = b.ROUND();
    if (b.isNull) {
        return Null
    }
    if (b instanceof CurrencyType) {
        return b
    }
    return new IntegerType(b)
}
function ARFuncConvert() {
    Log("ARFuncConvert() - unsupported");
    getCurWFC_NS(getCurrentWindowID_NS()).status(9369)
}
function ARFuncLength(b) {
    return ARFuncLengthC(b)
}
function ARFuncSubstr(b, f, d) {
    return ARFuncSubstrC(b, f, d)
}
function ARFuncLeft(d, b) {
    return ARFuncLeftC(d, b)
}
function ARFuncRight(d, b) {
    return ARFuncRightC(d, b)
}
function ARFuncLTrim(d) {
    if (d.isNull) {
        return d
    }
    var b = d.toString().trim(1, true);
    return (b != "") ? new CharType(b) : Null
}
function ARFuncRTrim(d) {
    if (d.isNull) {
        return d
    }
    var b = d.toString().trim(2, true);
    return (b != "") ? new CharType(b) : Null
}
function ARFuncLPad(d, f, b) {
    return ARFuncLPadC(d, f, b)
}
function ARFuncRPad(d, f, b) {
    return ARFuncRPadC(d, f, b)
}
function ARFuncReplace(k, h, f) {
    if (k.isNull || h.isNull) {
        return Null
    }
    if (h.toString() == "") {
        return k
    }
    var s = k.toString();
    var q = h.toString();
    var o = f.toString();
    var v = s;
    var p = /\n/g;
    var b = /^\n$/g;
    var d = /\r\n/g;
    var g = /\r\n/g;
    if (s.search(d) != -1) {
        s = s.replace(d, "\n")
    }
    if (q.search(g) != -1) {
        q = q.replace(g, "\n")
    }
    var u = new RegExp(q.toRegExp(), "g");
    v = s.replace(u, o);
    return (v != "") ? new CharType(v) : Null
}
function ARFuncStrstr(d, b) {
    return ARFuncStrstrC(d, b)
}
function ARFuncMin() {
    var b = new Array(arguments.length + 1);
    b[0] = "LT";
    for (var d = 0; d < arguments.length; ++d) {
        b[d + 1] = arguments[d]
    }
    return ARFunc_MinMax.apply(null, b)
}
function ARFuncMax() {
    var b = new Array(arguments.length + 1);
    b[0] = "GT";
    for (var d = 0; d < arguments.length; ++d) {
        b[d + 1] = arguments[d]
    }
    return ARFunc_MinMax.apply(null, b)
}
function ARFunc_MinMax(f) {
    var b;
    for (var g = 1; g < arguments.length; ++g) {
        var d = arguments[g];
        if (!d.isNull && (!b || d[f](b))) {
            b = d
        }
    }
    if (!b) {
        b = Null
    }
    return b
}
function ARFunc_ColSumAvg(h, d) {
    if (h instanceof JColumn) {
        if (h.IsTimeRelatedField()) {
            return Null
        }
        var o = h.getTable();
        var f = 0;
        var g = o.GetRow();
        var q = new RealType(0);
        if (h.GetType() == 12) {
            var p = h.GetDataField();
            q = new CurrencyType("0", p);
            q.mCurCode = p.GetDefaultCurrency();
            q.mPrecision = p.GetPrecision(q.mCurCode);
            if (p.mFunctional == null || p.mFunctional[q.mCurCode] == null) {
                q.mCurCode = null
            }
        }
        for (var b = 0; b < o.GetRows(); ++b) {
            o.SetRow(b);
            var k = h.G();
            if (!k.isNull) {
                if (q.mCurCode == null && k.type == 12) {
                    q.mCurCode = k.mCurCode
                }
                q.ADD(q, k); ++f
            }
        }
        o.SetRow(g);
        if (f == 0) {
            return Null
        }
        if (d) {
            q.DIV(q, new RealType(f))
        }
        return q
    } else {
        if (h == DummyField) {
            return Null
        } else {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9368)
        }
    }
}
function ARFuncColSum(b) {
    return ARFunc_ColSumAvg(b, false)
}
function ARFuncColAvg(b) {
    return ARFunc_ColSumAvg(b, true)
}
function ARFuncColCount(o) {
    if (o instanceof JColumn) {
        var h = o.getTable();
        if (!h.mResult) {
            return Null
        }
        var g = 0;
        var f = h.GetRow();
        for (var d = 0; d < h.GetRows(); ++d) {
            h.SetRow(d);
            var b = o.G();
            if (!b.isNull) {++g
            }
        }
        h.SetRow(f);
        return new IntegerType(g)
    } else {
        if (o instanceof DTable) {
            if (!o.mResult) {
                return Null
            }
            var k = o.GetRows();
            return new IntegerType(k)
        } else {
            if (o == DummyField) {
                return Null
            } else {
                getCurWFC_NS(getCurrentWindowID_NS()).status(9368)
            }
        }
    }
}
function ARFunc_ColMinMax(o, f) {
    if (o instanceof JColumn) {
        var k = o.getTable();
        if (k.GetRows() == 0) {
            return Null
        }
        var h = k.GetRow();
        var b;
        for (var g = 0; g < k.GetRows(); ++g) {
            k.SetRow(g);
            var d = o.G();
            if (!d.isNull && (!b || d[f](b))) {
                b = d
            }
        }
        k.SetRow(h);
        if (!b) {
            b = Null
        }
        return b
    } else {
        if (o == DummyField) {
            return Null
        } else {
            getCurWFC_NS(getCurrentWindowID_NS()).status(9368)
        }
    }
}
function ARFuncColMin(b) {
    return ARFunc_ColMinMax(b, "LT")
}
function ARFuncColMax(b) {
    return ARFunc_ColMinMax(b, "GT")
}
function ARFuncDateAdd(d, f, b) {
    if (d.isNull || f.isNull || b.isNull) {
        return Null
    }
    d = d.toString();
    f = new IntegerType(f.toInteger());
    b = b.toDate();
    if (ARFuncIsDatepartDay(d)) {
        return b.ADD(b, f)
    } else {
        if (ARFuncIsDatepartWeek(d)) {
            return b.ADDWEEKS(f)
        } else {
            if (ARFuncIsDatepartMonth(d)) {
                return b.ADDMONTHS(f)
            } else {
                if (ARFuncIsDatepartYear(d)) {
                    return b.ADDYEARS(f)
                }
            }
        }
    }
    return Null
}
function ARFuncDateDiff(f, d, b) {
    if (f.isNull || d.isNull || b.isNull) {
        return Null
    }
    f = f.toString();
    d = d.toDate();
    b = b.toDate();
    if (ARFuncIsDatepartDay(f)) {
        return new IntegerType(b.toInteger() - d.toInteger())
    } else {
        if (ARFuncIsDatepartWeek(f)) {
            return new IntegerType(Math.floor((b.toInteger() - d.toInteger()) / 7))
        }
    }
    return Null
}
function ARFuncDateName(d, b) {
    if (d.isNull || b.isNull) {
        return Null
    }
    d = d.toString();
    var f = ARDate.parseDate(b.toString());
    if (f == null) {
        return Null
    }
    if (ARFuncIsDatepartMonth(d)) {
        return new CharType(ARDate.MonthLabel(f.GMonth()))
    } else {
        if (ARFuncIsDatepartWeekday(d)) {
            return new CharType(f.DayLong())
        }
    }
    return Null
}
function ARFuncDateNum(d, b) {
    if (d.isNull || b.isNull) {
        return Null
    }
    d = d.toString();
    var f = ARDate.parseDateTime(b.toString());
    if (f == null) {
        return Null
    }
    if (ARFuncIsDatepartYear(d)) {
        return new IntegerType(f.GYear())
    } else {
        if (ARFuncIsDatepartMonth(d)) {
            return new IntegerType(f.GMonth() + 1)
        } else {
            if (ARFuncIsDatepartDay(d)) {
                return new IntegerType(f.GDate())
            } else {
                if (ARFuncIsDatepartWeek(d)) {
                    return new IntegerType(f.GWeekNumber())
                } else {
                    if (ARFuncIsDatepartWeekday(d)) {
                        return new IntegerType(f.GDay() + 1)
                    }
                }
            }
        }
    }
    return Null
}
function ARFuncCurrConvert(d, f, b) {
    if (d.isNull || f.isNull || b.isNull) {
        return Null
    }
    return d.CurrConvert(f.toString(), b.toInteger())
}
function ARFuncCurrSetDate(d, b) {
    if (d.isNull || b.isNull) {
        return Null
    }
    return d.CurrSetDate(b.toTime().toInteger())
}
function ARFuncCurrSetType(b, d) {
    if (b.isNull || d.isNull) {
        return Null
    }
    return b.CurrSetType(d)
}
function ARFuncCurrSetValue(b, d) {
    if (b.isNull || d.isNull) {
        return Null
    }
    return b.CurrSetValue(d.toDecimal())
}
function ARFuncLengthC(b) {
    if (b.isNull) {
        return b
    }
    return new IntegerType(b.toString().length)
}
function ARFuncLeftC(h, g) {
    if (h.isNull || g.isNull) {
        return Null
    }
    var d = h.toString();
    var b = g.toInteger();
    var f = d.substring(0, b);
    return (f != "") ? new CharType(f) : Null
}
function ARFuncRightC(h, g) {
    if (h.isNull || g.isNull) {
        return Null
    }
    var d = h.toString();
    var b = g.toInteger();
    var f = d.substring(d.length - b);
    return (f != "") ? new CharType(f) : Null
}
function ARFuncLPadC(k, f, d) {
    if (k.isNull || f.isNull || d.isNull) {
        return Null
    }
    var p = k.toString();
    var b = f.toInteger();
    var o = d.toString();
    if (o == "") {
        return k
    }
    var q = o;
    var g = b - p.length;
    while (g > q.length) {
        q += o
    }
    var h = q.substring(0, g) + p;
    return (h != "") ? new CharType(h) : Null
}
function ARFuncRPadC(k, f, d) {
    if (k.isNull || f.isNull || d.isNull) {
        return Null
    }
    var p = k.toString();
    var b = f.toInteger();
    var o = d.toString();
    if (o == "") {
        return k
    }
    var q = o;
    var g = b - p.length;
    while (g > q.length) {
        q += o
    }
    var h = p + q.substring(0, g);
    return (h != "") ? new CharType(h) : Null
}
function ARFuncStrstrC(g, f) {
    if (g.isNull || f.isNull) {
        return Null
    }
    var d = g.toString();
    var b = f.toString();
    return new IntegerType(d.indexOf(b))
}
function ARFuncSubstrC(o, k, h) {
    if (o.isNull || k.isNull) {
        return Null
    }
    var d = o.toString();
    var p = k.toInteger();
    var b = d.length;
    if (p < 0 || p > b) {
        return Null
    }
    if (h && h instanceof Datatype && !(h.isNull)) {
        var g = h.toInteger();
        if ((g < p && g >= 0) || (g + 1) == p) {
            return Null
        }
        if (g >= p && g < b) {
            b = g
        }
    }
    var f = d.substring(p, b + 1);
    return (f != "") ? new CharType(f) : Null
}
function ARFuncEncrypt() {
    Log("ARFuncEncrypt() - unsupported");
    getCurWFC_NS(getCurrentWindowID_NS()).status(9369)
}
function ARFuncDecrypt() {
    Log("ARFuncDecrypt() - unsupported");
    getCurWFC_NS(getCurrentWindowID_NS()).status(9369)
}
function ARFuncIsDatepartYear(b) {
    b = b.toLowerCase();
    return (b == "year" || b == "yyyy" || b == "yy")
}
function ARFuncIsDatepartMonth(b) {
    b = b.toLowerCase();
    return (b == "month" || b == "mm" || b == "m")
}
function ARFuncIsDatepartDay(b) {
    b = b.toLowerCase();
    return (b == "day" || b == "md" || b == "dd")
}
function ARFuncIsDatepartWeek(b) {
    b = b.toLowerCase();
    return (b == "week" || b == "wk" || b == "ww")
}
function ARFuncIsDatepartWeekday(b) {
    b = b.toLowerCase();
    return (b == "weekday" || b == "wd")
}
function ARFuncTemplate() {
    var d = arguments[0];
    if (d instanceof Datatype) {
        if (d.isNull) {
            return Null
        }
        d = d.toString()
    }
    var b = getCurrentWindowID_NS();
    var g = T(b, d);
    if (!g) {
        return Null
    }
    for (var f = 1; f < (arguments.length - 1); f += 2) {
        var k = arguments[f];
        if (k instanceof Datatype) {
            k = k.toString()
        }
        var h = arguments[f + 1];
        if (h instanceof Datatype) {
            h = h.toString()
        }
        g.S(k, h)
    }
    return new CharType(g.process(b))
}
function ARFuncHover(b) {
    var h = b.mValue;
    var g = getCurrentWindowID_NS();
    var d = hoverState.getHoverFID(g, h);
    if (d == -1 || d != h) {
        return new CharType("")
    }
    var f = hoverState.getHoverValue(g, h);
    return new CharType(f)
}
function ARFuncSelectedRowCount(p) {
    var q = F(getCurrentWindowID_NS(), p.mValue);
    if (q && q.mPrimaryRowSelection) {
        var k = 0;
        if (q instanceof DTreeView) {
            k++;
            var b = q.mResult.f.length;
            var s = q.mRowsPresent;
            var o = q.mResult.idmap[q.mPrimaryRowSelection];
            var f = q.mResult.r[o];
            var d = false;
            outer: for (var h = (o + 1); h < s; h++) {
                inner: for (var g = 0; g < b - 1; g++) {
                    if (q.mResult.r[h].d[g].v != f.d[g].v) {
                        d = true;
                        break inner
                    }
                }
                if (d) {
                    break outer
                }
                k++
            }
            return new IntegerType(k)
        } else {
            for (var h in q.mRowSelections) {
                k++
            }
            return new IntegerType(k)
        }
    }
}
function ARFuncDroppedRowIndex(b) {
    var f = b.mValue;
    var d = F(getCurrentWindowID_NS(), f);
    if (d && "mMouseUpRowSelection" in d) {
        return new IntegerType(d.mMouseUpRowSelection + 1)
    } else {
        return new IntegerType(0)
    }
}
function ARFuncDroppedColumnIndex(b) {
    var f = b.mValue;
    var d = F(getCurrentWindowID_NS(), f);
    if (d && "mMouseUpColSelection" in d) {
        return new IntegerType(d.mMouseUpColSelection + 1)
    } else {
        return new IntegerType(0)
    }
}
function ARFuncMapGet(g, f) {
    if (g == null || f == null) {
        return Null
    }
    if (f instanceof Datatype) {
        f = f.toString()
    }
    var b = M(getCurrentWindowID_NS(), g);
    if (b == null) {
        return Null
    }
    var d = b.getValue(f);
    return (typeof d != "undefined" && d != null && d != "") ? new CharType(d) : Null
}
function ARFuncListGet(g, b) {
    if (g == null || b == null) {
        return Null
    }
    if (b instanceof Datatype) {
        b = b.toInteger()
    }
    var f = ARR(getCurrentWindowID_NS(), g);
    if (f == null) {
        return Null
    }
    var d = f.getValue(b);
    return (typeof d != "undefined" && d != null && d != "") ? new CharType(d) : Null
}
function ARFuncListSize(d) {
    if (d == null) {
        return null
    }
    var b = ARR(getCurrentWindowID_NS(), d);
    if (b == null) {
        b = M(getCurrentWindowID_NS(), d)
    }
    return (b == null) ? new IntegerType(0) : new IntegerType(b.size())
}
function MenuElement(b, d, h, g, f) {
    this.mSubMenuMap = g;
    this.mDef = h;
    this.mSerial = d;
    this.mEncode = f;
    this.windowID = b
}
MenuElement.prototype.mW = MenuElement.prototype.mH = MenuElement.prototype.mRowH = MenuElement.prototype.mRowCnt = MenuElement.prototype.mScrollDir = MenuElement.prototype.mScrollTarget = MenuElement.prototype.mRowsPerScreen = MenuElement.prototype.mOpenPref = MenuElement.prototype.mMinScrollY = 0;
MenuElement.prototype.mElement = MenuElement.prototype.mScrollTimer = MenuElement.prototype.mHighlightedElement = null;
MenuElement.prototype.mNeedToScroll = false;
MenuElement.prototype.BuildAndMeasure = function(S, L, B) {
    if (this.mElement != null) {
        return
    }
    var P = this.mSerial;
    var d = document.createElement("DIV");
    d.className = "MenuOuter";
    d.setAttribute("armenuelementserial", "" + P);
    d.style.zIndex = ++nextZIndex;
    d.style.left = -2000;
    var E = [];
    E.push("<DIV class=MenuScrollUp>&#9650;</DIV>");
    E.push("<DIV class=MenuTableContainer><TABLE class=MenuTable cellpadding=0 cellspacing=0><TBODY class=MenuTableBody>");
    var k = "<TR class=MenuTableRow>",
    s = "<TR class=MenuTableRowDisabled>";
    var y = "<TD class=MenuEntryName nowrap",
    A = "</TD><TD class=MenuEntrySub arsubmenu=";
    var g = '">',
    J = ">",
    I = '</TD><TD class=MenuEntryNoSub ARValue="',
    u = "</TD></TR>";
    var C = "&#9658;";
    for (var K in this.mDef) {
        var O = this.mDef[K];
        if (O.v == null) {
            O.v = O.l
        }
        var f = ("s" in O && O.s == 0) ? true: false;
        if (f) {
            E.push(s)
        } else {
            E.push(k)
        }
        E.push(y);
        var q = (typeof O.v != "string");
        var D = (this.mEncode ? O.l.ValidatorUnEscape().HTMLEncode() : O.l);
        if (q) {
            E.push(J);
            E.push(D);
            E.push(A);
            if (! ("s" in O && O.s == 0)) {
                E.push(K)
            }
            E.push(J);
            E.push(C)
        } else {
            E.push(J);
            E.push(O.l == "" ? "&nbsp;": D);
            E.push(I);
            if (typeof O.v == "string" && O.v.charAt(0) == "\t") {
                E.push("\\")
            }
            E.push(this.mEncode ? O.v.ValidatorUnEscape().HTMLEncode() : O.v);
            E.push(g)
        }
        E.push(u)
    }
    if (B) {
        E.push(k);
        E.push(y);
        E.push(J);
        E.push(getLocalizedMessage("(clear)").HTMLEncode());
        E.push(I);
        E.push(g)
    }
    E.push("</TBODY></TABLE></DIV><DIV class=MenuScrollDown>&#9660;</DIV>");
    d.innerHTML = E.join("");
    document.body.appendChild(d);
    this.mElement = d;
    var p = d.childNodes[0];
    var H = d.childNodes[2];
    var R = d.childNodes[1];
    var Q = R.firstChild;
    var b = R.firstChild.firstChild;
    var v = Q.offsetWidth,
    N = Q.offsetHeight;
    if (S == 3 && v < L) {
        v = L
    }
    Q.style.width = p.style.width = H.style.width = v;
    p.style.visibility = H.style.visibility = "hidden";
    v += 2;
    N += 2;
    d.style.width = v;
    this.mW = v;
    this.mH = N;
    var o = b.firstChild;
    if (o == null) {
        this.mRowCnt = 0;
        this.mRowH = 0;
        return
    }
    var G = o;
    while (G.nextSibling && this.mRowH == 0) {
        this.mRowH = G.nextSibling.firstChild.offsetTop - G.firstChild.offsetTop;
        G = G.nextSibling
    }
    if (this.mRowH == 0) {
        this.mRowH = o.firstChild.offsetHeight
    }
    this.mRowCnt = o.parentNode.childNodes.length
};
MenuElement.prototype.Scroll = function(b) {
    if (!this.mNeedToScroll) {
        return
    }
    this.mScrollDir = b;
    this.ScrollTimeout()
};
MenuElement.prototype.ScrollToRow = function(f) {
    if (!this.mNeedToScroll) {
        return
    }
    var b = 0;
    for (; f; f = f.previousSibling, b++) {}
    var d = -Math.floor(this.mScrollTarget / this.mRowH);
    if (b <= d) {
        this.DoScroll((d - b + 1) * this.mRowH)
    } else {
        if (b >= d + this.mRowsPerScreen) {
            var g = Math.floor(b - (d + this.mRowsPerScreen));
            this.DoScroll( - g * this.mRowH)
        }
    }
};
MenuElement.prototype.ScrollTimeout = function() {
    this.DoScroll(this.mScrollDir * this.mRowH);
    var b = (this.mScrollTimer == null);
    this.mScrollTimer = setTimeout(function() {
        OpenedMenu.mElementStack[OpenedMenu.mElementStack.length - 1].ScrollTimeout()
    },
    b ? 150 : 20)
};
MenuElement.prototype.DoScroll = function(d) {
    this.mScrollTarget += d;
    this.mScrollTarget = (this.mScrollTarget < this.mMinScrollY ? this.mMinScrollY: this.mScrollTarget);
    this.mScrollTarget = (this.mScrollTarget > 0 ? 0 : this.mScrollTarget);
    var b = this.mElement.childNodes[1];
    b.style.top = this.mScrollTarget + 20
};
MenuElement.prototype.EndScroll = function() {
    if (this.mScrollTimer != null) {
        clearTimeout(this.mScrollTimer);
        this.mScrollTimer = null
    }
};
MenuElement.prototype.Close = function() {
    if (this.mScrollTimer != null) {
        clearTimeout(this.mScrollTimer)
    }
    var b = this.mElement;
    this.UnHighlightElement();
    if (OpenedMenu.mAnimate && this.mSerial == 0 && typeof AnimMgr != "undefined") {
        AnimMgr.WipeOutMenu(b, OpenedMenu)
    } else {
        b.style.visibility = "hidden"
    }
    OpenedMenu.mElementStack.pop();
    if (OpenedMenu != null) {
        if (!OpenedMenu.mElementStack.length) {
            OpenedMenu.Close()
        }
    }
};
function GetMenuElemCoords(u, d, v, g, f) {
    var w = u;
    var h = ComputeElementPosition(w, document.body, 0, 0);
    var p = h.x;
    var k = h.y;
    var o = document.body.scrollTop;
    var b = document.body.scrollLeft;
    var s = window.innerWidth + b;
    var q = p;
    if (d == 0) {
        p += u.offsetWidth + v
    } else {
        if (d == 1) {
            k += u.offsetHeight
        } else {
            if (d == 3) {
                k += u.offsetHeight
            } else {
                if (d == 2) {
                    p = q - (f + g) + u.offsetWidth + v
                } else {}
            }
        }
    }
    if (g != 0) {
        if (p + f > s && d != 2) {
            d = 2;
            p = q - (f + g) + u.offsetWidth + v
        } else {
            if (p < b && d != 0) {
                d = 0;
                p = q + (u.offsetWidth + v)
            }
        }
    }
    k = (k < o ? o: k);
    p = (p < b ? b: p);
    if (k < 0) {
        k = 0
    }
    return {
        x: p,
        y: k,
        open_pref: d
    }
}
MenuElement.prototype.Open = function(k, G, w, b, p, C, A) {
    this.mZIndex = p;
    this.BuildAndMeasure(G, k.offsetWidth, A);
    var h = GetMenuElemCoords(k, G, w, b, this.mW);
    var u = h.x,
    s = h.y;
    if (C != null) {
        u += C.x;
        s += C.y
    }
    this.mOpenPref = h.open_pref;
    this.mNeedToScroll = false;
    var B = this.mElement;
    var H = document.body.scrollTop;
    var o = window.innerHeight + H;
    var f = o - H;
    var D = this.mH < f ? this.mH: f;
    if (this.mH > D) {
        this.mNeedToScroll = true;
        B.style.height = D;
        var q = B.childNodes[0],
        E = B.childNodes[1],
        v = B.childNodes[2];
        q.style.height = v.style.height = 20;
        q.style.visibility = v.style.visibility = "inherit";
        E.style.top = 20;
        var g = D - 20 * 2 - 2;
        if (g < this.mRowH) {
            g = this.mRowH
        }
        g -= g % this.mRowH;
        this.mRowsPerScreen = g / this.mRowH;
        D = 20 * 2 + g + 2;
        v.style.top = D - 20 - 2;
        this.mMinScrollY = -((this.mRowCnt - this.mRowsPerScreen) * this.mRowH)
    }
    if (s + D >= o) {
        s = o - D
    }
    B.style.height = D;
    var d = document.body.scrollLeft;
    var I = window.innerWidth + d;
    if (u + this.mW >= I) {
        u = I - this.mW
    }
    OpenedMenu.mElementStack.push(this);
    if (OpenedMenu.mAnimate && this.mSerial == 0 && typeof AnimMgr != "undefined") {
        AnimMgr.WipeInMenu(B)
    } else {
        B.style.visibility = "inherit"
    }
    B.style.top = s;
    B.style.left = (u < 0 ? 0 : u)
};
MenuElement.prototype.HighlightElement = function(f) {
    this.UnHighlightElement();
    this.mHighlightedElement = f;
    var b = "Hover";
    for (var d = f; d; d = d.nextSibling) {
        if (d.className.indexOf(b) == -1) {
            d.className += b
        }
    }
    OpenedMenu.EnsureTopElement(this.mSerial);
    this.focusHighlightedElement()
};
MenuElement.prototype.focusHighlightedElement = function() {
    if (this.mFocusTimeout) {
        clearTimeout(this.mFocusTimeout)
    }
    this.mFocusTimeout = null;
    var b = this.mHighlightedElement
};
MenuElement.prototype.CheckOpenSubMenu = function() {
    if (this.mHighlightedElement == null) {
        return
    }
    var d = this.mHighlightedElement;
    if (d.nextSibling && d.nextSibling.getAttribute("arsubmenu")) {
        var b = parseInt(d.nextSibling.getAttribute("arsubmenu"));
        b = this.mSubMenuMap[b];
        if (!OpenedMenu.ElementAtTop(b)) {
            OpenedMenu.OpenLevel(b, d.nextSibling, this.mOpenPref == 2 ? 2 : 0, 2, this.mW, false)
        }
    }
};
MenuElement.prototype.UnHighlightElement = function() {
    if (this.mHighlightedElement == null) {
        return
    }
    var g = this.mHighlightedElement;
    var d = "Hover";
    for (var f = g; f; f = f.nextSibling) {
        var b = f.className.indexOf(d);
        if (b != -1) {
            f.className = f.className.substr(0, b)
        }
    }
    this.mHighlightedElement = null
};
MenuElement.prototype.HandleKeyEvent = function(d) {
    var b = d.key;
    if (b == 37) {
        if (this.mSerial != 0) {
            this.Close();
            if (OpenedMenu && OpenedMenu.mElementStack.length > 0) {
                OpenedMenu.mElementStack[OpenedMenu.mElementStack.length - 1].focusHighlightedElement()
            }
        }
    } else {
        if (b == 38) {
            this.AdvanceHighlight( - 1)
        } else {
            if (b == 39) {
                this.CheckOpenSubMenu();
                OpenedMenu.mElementStack[OpenedMenu.mElementStack.length - 1].AdvanceHighlight(1)
            } else {
                if (b == 40) {
                    this.AdvanceHighlight(1)
                } else {
                    if (b == 27) {
                        Menu_Close()
                    } else {
                        if (b == 13) {
                            this.CheckOpenSubMenu();
                            OpenedMenu.CheckClick()
                        } else {
                            if (b == 9) {
                                this.focusHighlightedElement()
                            } else {
                                if (b >= 32 && b < 255) {
                                    this.AdvanceHighlightToCharacter(b);
                                    return true
                                }
                                return false
                            }
                        }
                    }
                }
            }
        }
    }
    return true
};
MenuElement.prototype.AdvanceHighlightToCharacter = function(p) {
    var h = this.mHighlightedElement;
    if (h == null) {
        return
    }
    var f = String.fromCharCode(p);
    f = f.toLowerCase();
    var k = h.parentNode,
    o = k,
    g = o.parentNode.childNodes[o.parentNode.childNodes.length - 1];
    do {
        var d = k.firstChild;
        var b = d.firstChild;
        if (b != null && b.length > 0 && (b.data.charAt(0).toLowerCase() == f)) {
            this.HighlightElement(k.firstChild);
            this.ScrollToRow(k)
        }
        k = k.previousSibling;
        if (k == null) {
            k = g
        }
    } while ( k != o )
};
MenuElement.prototype.CheckClick = function() {
    var d = this.mHighlightedElement;
    if (d == null || d.parentNode == null || d.parentNode.className == "MenuTableRowDisabled") {
        return null
    }
    var b = d.nextSibling.getAttribute("arvalue");
    if (b.length > 1 && b.substr(0, 2) == "\\\t") {
        b = b.substr(1)
    }
    return b
};
MenuElement.prototype.AdvanceHighlight = function(f) {
    var g = this.mHighlightedElement;
    if (g == null) {
        var b = this.mElement.childNodes[1];
        h = b.firstChild.firstChild.firstChild
    } else {
        var h = g.parentNode;
        if (f == 1) {
            h = h.nextSibling;
            if (h == null) {
                h = g.parentNode.parentNode.firstChild
            }
        } else {
            if (f == -1) {
                h = h.previousSibling;
                if (h == null) {
                    var d = g.parentNode.parentNode.childNodes;
                    h = d[d.length - 1]
                }
            }
        }
    }
    this.HighlightElement(h.firstChild);
    this.ScrollToRow(h)
};
MenuElement.prototype.HandleMouseEvent = function(d, h) {
    var g = h.element;
    var f = g.className;
    if (f == null) {
        return
    }
    if (d == 1) {
        if (g.tagName != "TD" || f.indexOf("MenuEntry") == -1) {
            return
        }
        this.EndScroll();
        g = g.parentNode.firstChild;
        this.HighlightElement(g);
        this.CheckOpenSubMenu()
    } else {
        if (d == 0) {
            if (f.indexOf("MenuEntry") != -1) {
                OpenedMenu.CheckClick()
            }
        } else {
            if (d == 2) {
                if (g.tagName != "DIV" && (f != "MenuScrollDown" || f != "MenuScrollUp")) {
                    return
                }
                var b = (f == "MenuScrollUp") ? 1 : -1;
                OpenedMenu.EnsureTopElement(this.mSerial);
                this.Scroll(b)
            } else {
                if (d == 3) {
                    if (g.tagName != "DIV" && (f != "MenuScrollDown" || f != "MenuScrollUp")) {
                        return
                    }
                    OpenedMenu.EnsureTopElement(this.mSerial);
                    this.EndScroll()
                } else {}
            }
        }
    }
    return
};
Menu.prototype.constructor = Menu;
function Menu(b, d) {
    if (arguments.length) {
        this.init(b, d)
    }
}
Menu.prototype.init = function(b, d) {
    this.windowID = b;
    this.mMenuDef = d;
    this.mElements = [];
    this.mElementStack = [];
    this.mSerialCnt = 0;
    this.mZIndex = 30100;
    this.mField = DummyField;
    this.mIFrameStack = [];
    this.mXAdjust = 0;
    this.mYAdjust = 0;
    this.mAnimate = true
};
Menu.prototype.ElementAtTop = function(b) {
    return (this.mElementStack[this.mElementStack.length - 1].mSerial == b)
};
Menu.prototype.openBoxMenu = function(o, f) {
    var b = getLocalizedMessage("(no entries in menu)");
    var s = getLocalizedMessage("(clear)");
    var g = {
        addClear: f,
        menuMsgs: gMenuMessages,
        menuMsgArgs: gMenuMsgArgs,
        menu: this,
        noent: b,
        clr: s
    };
    var q = "";
    if (this.mField) {
        if (this.mField != DummyField && (typeof this.mField.GLabelOrName != "undefined")) {
            var h = this.mField.GLabelOrName();
            q = (h == null) ? (this.mName ? this.mName: "") : h
        } else {
            if (this.mName) {
                q = this.mName
            }
        }
    }
    var d = this.windowID;
    var p = this.mField;
    var k = {};
    return {
        n: {
            f: function() {
                if (k.result.retval) {
                    if (OpenedMenu == null) {
                        OpenedMenu = this
                    }
                    return {
                        n: {
                            f: function() {
                                OpenedMenu = null
                            },
                            a: [OpenedMenu]
                        },
                        c: {
                            f: OpenedMenu.HandleSelection,
                            t: OpenedMenu,
                            a: [k.result.retval + ""]
                        }
                    }
                } else {
                    return {
                        n: {
                            f: function() {
                                OpenedMenu = null
                            },
                            a: [OpenedMenu]
                        }
                    }
                }
            },
            a: [k],
            t: this
        },
        c: {
            f: function() {
                return MenuBoxPopup(d, o, q, g, k)
            }
        }
    }
};
Menu.prototype.OpenPopup = function(f, d, g, b) {
    this.RecurBuild(this.mMenuDef);
    if (typeof g == "number") {
        this.mZIndex = g
    }
    this.mSerialCnt = 0;
    OpenedMenu = this;
    OpenedMenu.OpenLevel(0, f, d, 0, 0, b)
};
Menu.prototype.OpenListBox = function(f, d, g, b) {
    return {
        n: {
            f: this.openBoxPopup,
            t: this,
            a: [f, d, g, b]
        }
    }
};
Menu.prototype.Open = function(g, f, k, d) {
    var b = 1;
    var h = this.useMenuTypePref();
    var o = this.getMenuPrefType();
    if (h && o != 0) {
        if (o == 3) {
            b = this.evalSmartMenu()
        } else {
            b = o
        }
    }
    if (b == 1) {
        return {
            n: {
                f: this.OpenPopup,
                t: this,
                a: [g, f, k, d]
            }
        }
    } else {
        return {
            n: {
                f: this.OpenListBox,
                t: this,
                a: [g, f, k, d]
            }
        }
    }
};
function Menu_Close() {
    if (OpenedMenu != null) {
        OpenedMenu.Close()
    }
    OpenedMenu = null
}
Menu.prototype.Close = function() {
    for (var b = this.mElementStack.length - 1; b >= 0; --b) {
        this.mElementStack[b].Close()
    }
};
Menu.prototype.removeElements = function() {
    if (this.mElementStack.length != 0) {
        return
    } else {
        for (var b in this.mElements) {
            if (this.mElements[b].mElement != null) {
                document.body.removeChild(this.mElements[b].mElement)
            }
        }
        this.mElements = []
    }
};
Menu.prototype.EnsureTopElement = function(b) {
    var d = this.mElementStack;
    while (d[d.length - 1].mSerial != b) {
        d[d.length - 1].Close()
    }
};
Menu.prototype.CheckClick = function() {
    var d = this.mElementStack;
    var b = d[d.length - 1].CheckClick();
    if (typeof CharFieldMenu != "undefined" && this instanceof CharFieldMenu && this.mQueryReturnedNoValues && b.length != 0) {
        Menu_Close();
        return
    }
    if (b != null) {
        Menu_Close();
        this.HandleSelection(b)
    }
};
Menu.prototype.OpenLevel = function(g, h, d, k, f, b) {
    this.mElements[g].Open(h, d, k, f, this.mZIndex, (g == 0 ? {
        x: this.mXAdjust,
        y: this.mYAdjust
    }: null), b)
};
Menu.prototype.CloseLevel = function() {
    this.mElementStack[this.mElementStack.length - 1].Close()
};
Menu.prototype.RecurBuild = function(g) {
    var h = this.mSerialCnt++,
    f = {};
    for (var b in g) {
        var d = g[b];
        if (typeof d.v != "string") {
            f[b] = this.mSerialCnt;
            this.RecurBuild(d.v)
        }
    }
    this.mElements[h] = new MenuElement(this.windowID, h, g, f, this.doEncode())
};
Menu.prototype.doEncode = function() {
    var b = this.mField.mID;
    return (b == 112 || b == 104 || (b >= 2000 && b <= 2199))
};
Menu.prototype.contains = function(g, f) {
    if (f && f.length > 0) {
        for (var b in f) {
            var d = f[b];
            if ((g == d.l) || (d.v instanceof Array && this.contains(g, d.v))) {
                return true
            }
        }
    }
    return false
};
Menu.prototype.getMenuPrefType = function() {
    return ARPrefsGetAsNumber(20105)
};
Menu.prototype.useMenuTypePref = function() {
    if (typeof CharFieldMenu != "undefined" && this instanceof CharFieldMenu) {
        var b = true;
        if (this.mField) {
            if (this.mField instanceof TPAChar || this.mField instanceof JChar || this.mField instanceof DChar) {
                if (this.mField.isDropDown()) {
                    b = false
                }
            }
        }
        return b
    } else {
        return false
    }
};
Menu.prototype.walkMenuDef = function(g, f) {
    for (var d in g) {
        if (g[d].v instanceof Array) {
            f.levels++;
            if (f.levels >= f.maxLevels) {
                return 2
            } else {
                var b = this.walkMenuDef(g[d].v, f);
                if (b == 2) {
                    return b
                } else {
                    if (f.items >= f.maxItems) {
                        return 2
                    }
                    f.levels = 0
                }
            }
        } else {
            f.items++;
            if (f.items >= f.maxItems) {
                return 2
            }
        }
    }
    return 1
};
Menu.prototype.evalSmartMenu = function() {
    var f = ARPrefsGetAsNumber(23240);
    if (isNaN(f) || f == null || f <= 0) {
        f = 200
    }
    var b = ARPrefsGetAsNumber(23241);
    if (isNaN(b) || b == null || b <= 0) {
        b = 4
    }
    if (this.mMenuDef.length >= f) {
        return 2
    }
    var d = {
        items: 0,
        levels: 0,
        maxItems: f,
        maxLevels: b
    };
    return this.walkMenuDef(this.mMenuDef, d)
};
Menu.prototype.openBoxPopup = function(f, d, g, b) {
    OpenedMenu = this;
    return {
        n: {
            f: this.openBoxMenu,
            a: [f, b],
            t: this
        }
    }
};
CharFieldMenu.prototype = new Menu();
CharFieldMenu.prototype.constructor = CharFieldMenu;
CharFieldMenu.superclass = Menu.prototype;
function CharFieldMenu(d, b) {
    if (arguments.length) {
        this.init(d, b)
    }
}
CharFieldMenu.prototype.init = function(d, b) {
    CharFieldMenu.superclass.init.call(this, d, b.mval);
    this.mField = null;
    this.mQueryReturnedNoValues = b.novals
};
CharFieldMenu.prototype.Open = function(f, d, b) {
    this.mField = f;
    return {
        n: {
            f: CharFieldMenu.superclass.Open,
            t: this,
            a: [d, 3, 30100, b]
        }
    }
};
CharFieldMenu.prototype.HandleSelection = function(b) {
    this.mField.HandleMenuSelection(b);
    promptBar.setToClear();
    if ("mColid" in this.mField) {
        new WorkflowContext(this.windowID, {
            f: ExecuteWorkflow,
            a: [this.windowID, 128, this.mField.mColid]
        })
    } else {
        new WorkflowContext(this.windowID, {
            f: ExecuteWorkflow,
            a: [this.windowID, 128, this.mField.mID]
        })
    }
    this.mField = null
};
function ARMenu(d, f, b) {
    this.mMenuName = f;
    this.mMenuData = ("novals" in b) ? b.mval: b;
    this.mCharFieldMenu = null;
    if (this.mMenuData != null && this.mMenuData instanceof Object && "novals" in b) {
        this.mCharFieldMenu = new CharFieldMenu(d, b)
    }
    getARMenuCache_NS(d)[this.mMenuName] = this;
    this.cfid = null;
    this.FieldMap = {}
}
function ACMenu() {
    this.state = 0;
    this.src = null;
    this.acField = null;
    this.arautocak = 1;
    this.lastKeystrokeMs = 0;
    this.typeState = 0;
    this.timer = null;
    this.dataCompleted = false;
    this.fText = "";
    this.foundPosition = -1;
    this.preLen = 0;
    this.direction = 1;
    this.messageOnly = true;
    this.tItems = -1;
    this.isLoadByMenu = false
}
ARMenu.prototype.addField = function(b) {
    this.FieldMap[b] = new ACMenu()
};
ARMenu.prototype.getAttribute = function(b, d) {
    return this.FieldMap[b][d]
};
ARMenu.prototype.setAttribute = function(b, f, d) {
    return this.FieldMap[b][f] = d
};
ARMenu.prototype.isACReloadable = function() {
    this.updateState();
    return this.getAttribute(this.cfid, "state") == 1 && this.getAttribute(this.cfid, "typeState") == 1 || this.mMenuData.r != 2 || this.getAttribute(this.cfid, "arautocak") == 0 || this.mMenuData.t != 4 || this.getAttribute(this.cfid, "arautocnc") == "err" || this.isRecovering()
};
ARMenu.prototype.isValidSearchMenu = function() {
    return this.mMenuData.r == 2 && this.getAttribute(this.cfid, "arautocak") > 0 && this.mMenuData.t == 4 && this.getAttribute(this.cfid, "arautocnc") != "err"
};
ARMenu.prototype.checkPause = function(b) {
    if (this.getAttribute(this.cfid, "lastKeystrokeMs") - b < 1000) {
        this.setAttribute(this.cfid, "typeState", 2)
    } else {
        this.setAttribute(this.cfid, "typeState", 1)
    }
    this.setAttribute(this.cfid, "lastKeystrokeMs", b)
};
ARMenu.prototype.setState = function(b) {
    if (this.getAttribute(this.cfid, "state") == 3) {
        return
    }
    this.setAttribute(this.cfid, "state", b)
};
ARMenu.prototype.updateState = function(f) {
    if (this.getAttribute(this.cfid, "state") == 3) {
        return
    }
    if (f) {
        this.setState(f);
        return
    }
    if (!this.getAttribute(this.cfid, "acField")) {
        return
    }
    var b = this.getAttribute(this.cfid, "acField").mInputNode.value.length;
    if (this.getAttribute(this.cfid, "direction") == -1) {
        if (b < this.getAttribute(this.cfid, "fText").length) {
            this.setAttribute(this.cfid, "fText", "")
        }
        this.setAttribute(this.cfid, "tItems", -1)
    }
    if (b == 0) {
        this.setState(0)
    } else {
        var d = this.isFull();
        if (this.getAttribute(this.cfid, "tItems") == 0) {
            if (this.getAttribute(this.cfid, "direction") == 1) {
                if (d && b > this.getAttribute(this.cfid, "foundPosition")) {
                    this.setState(2)
                } else {
                    this.setState(1)
                }
            } else {
                if (d && b > (this.getAttribute(this.cfid, "foundPosition") + 1)) {
                    this.setState(2)
                } else {
                    this.setState(1)
                }
            }
        } else {
            if (!d) {
                this.setState(1)
            }
        }
    }
    switch (this.getAttribute(this.cfid, "state")) {
    case 0:
        if (b >= this.getAttribute(this.cfid, "arautocak")) {
            this.setState(1)
        }
        break;
    case 1:
        if (b < this.getAttribute(this.cfid, "arautocak")) {
            this.setState(0)
        }
        break;
    case 2:
        if (b < this.getAttribute(this.cfid, "arautocak")) {
            this.setState(0)
        }
        break;
    default:
        break
    }
};
ARMenu.getMenu = function(b, d) {
    return getARMenuCache_NS(b)[d]
};
ARMenu.prototype.isRecovering = function() {
    var b = false;
    if (this.getAttribute(this.cfid, "acField") && this.getAttribute(this.cfid, "acField").acdirtyfocus) {
        b = this.getAttribute(this.cfid, "acField").acdirtyfocus
    }
    return (this.getAttribute(this.cfid, "state") >= 1 && this.getAttribute(this.cfid, "ac_kw_len") == -1) && b
};
ARMenu.prototype.reload = function() {
    var d = 0;
    if (this.mMenuName == undefined || !this.isACReloadable()) {
        return
    }
    var o = this.mMenuName;
    this.setAttribute(this.cfid, "tItems", -1);
    this.mCharFieldMenu = null;
    var p = this.getAttribute(this.cfid, "acField").mInputNode.getAttribute("arautocmb");
    var g = (p != null) && (p == "1");
    var h = this.getAttribute(this.cfid, "acField").mInputNode.getAttribute("arautoc");
    var f;
    if (this.isRecovering()) {
        if (this.getAttribute(this.cfid, "state") == 1) {
            f = this.getAttribute(this.cfid, "acField").mInputNode.value
        } else {
            if (this.getAttribute(this.cfid, "state") == 2) {
                f = this.getAttribute(this.cfid, "fText")
            } else {
                if (this.getAttribute(this.cfid, "state") == 3) {
                    if (this.getAttribute(this.cfid, "isLoadByMenu")) {
                        if (this.acField.isSearchOnly()) {
                            if (getARStateCurrent_NS(this.windowID) == 4) {
                                ARMenu_Open(this.getAttribute(this.cfid, "acField"), this.getAttribute(this.cfid, "acField").GMenu(), this.getAttribute(this.cfid, "acField").mInputNode, this.getAttribute(this.cfid, "acField").isSearchOnly());
                                return
                            } else {
                                ARMenu_Open(this.getAttribute(this.cfid, "acField"), this.getAttribute(this.cfid, "acField").GMenu(), this.getAttribute(this.cfid, "acField").mInputNode, false);
                                return
                            }
                        } else {
                            ARMenu_Open(this.getAttribute(this.cfid, "acField"), this.getAttribute(this.cfid, "acField").GMenu(), this.getAttribute(this.cfid, "acField").mInputNode, this.getAttribute(this.cfid, "acField").isDropDown());
                            return
                        }
                    } else {
                        f = ""
                    }
                }
            }
        }
    } else {
        f = this.getAttribute(this.cfid, "acField").mInputNode.value
    }
    var b = listOfMenuLeafValuesForField(this.getAttribute(this.cfid, "acField"), g, f);
    if (this.getAttribute(this.cfid, "acField").mAutoCompleteCreated) {
        this.getAttribute(this.cfid, "acField").mInputNode.actb_autoCompleted = false;
        if (b != null) {
            actb_values = (b.acValues != null) ? b.acValues: new Array();
            actb_keywords = (b.acLabels != null) ? b.acLabels: b.acValues;
            actb_lengths = (b.acLabelLengths != null) ? b.acLabelLengths: new Array();
            this.setAttribute(this.cfid, "ac_kw_len", actb_keywords.length)
        }
        var k = this.getAttribute(this.cfid, "acField")
    }
    if (this.getAttribute(this.cfid, "tItems") > 0) {
        this.setAttribute(this.cfid, "foundPosition", this.getAttribute(this.cfid, "acField").mInputNode.value.length)
    }
    if (this.getAttribute(this.cfid, "acType") == 0) {
        this.updateState(2)
    }
};
ARMenu.prototype.isFull = function() {
    return this.getAttribute(this.cfid, "state") == 3 || this.getAttribute(this.cfid, "fText") != "" && this.getAttribute(this.cfid, "acField").mInputNode.value.indexOf(this.getAttribute(this.cfid, "fText")) == 0
};
ARMenu.prototype.reInit = function() {
    window.acField = this.getAttribute(this.cfid, "acField")
};
function getMenuDataFromRequest(windowID, menu_name, definfo, rmserver, filter) {
    var menu = getARMenuCache_NS(windowID)[menu_name];
    if (menu == null) {
        handleMenuAbsent(menu_name);
        return {
            novals: false,
            mval: [],
            tItems: -1
        }
    }
    if (!menu.isACReloadable() && filter != null) {
        menu.setAttribute(menu.cfid, "requestLoad", false);
        return {
            novals: false,
            mval: [],
            tItems: -1
        }
    }
    if (menu.isRecovering() && filter == "" && menu.isValidSearchMenu()) {
        menu.setAttribute(menu.cfid, "requestLoad", false);
        return {
            novals: false,
            mval: [],
            tItems: -1
        }
    }
    menu.setAttribute(menu.cfid, "requestLoad", true);
    var rs = ARKWGetStringByIdx(windowID, 7),
    rf = ARKWGetStringByIdx(windowID, 6),
    q = {
        qual: "",
        fieldids: [],
        fieldvals: [],
        fieldtypes: []
    };
    var fieldids = [],
    fieldvals = [],
    fieldtypes = [],
    keyids = [],
    keyvals = [],
    keytypes = [];
    if (rmserver) {
        rs = ExpandServerName(windowID, rmserver)
    } else {
        if ("s" in definfo) {
            rs = ExpandServerName(windowID, definfo.s)
        }
    }
    if ("f" in definfo) {
        rf = ExpandSchemaName(windowID, definfo.f)
    }
    if ("q" in definfo) {
        eval("q=" + definfo.q);
        q = ExpandQualifier(windowID, q, rf, rs)
    }
    if ("ids" in definfo) {
        fieldids = definfo.ids;
        FieldList.PopulateValueAndTypeArrays(windowID, fieldids, fieldvals, fieldtypes)
    }
    if ("kwds" in definfo) {
        keyids = definfo.kwds;
        FieldList.PopulateValueAndTypeArrays(windowID, definfo.kwds, keyvals, keytypes)
    }
    var server = ((rmserver) ? rmserver: ARKWGetStringByIdx(windowID, 7));
    filter = filter || "";
    var arautocmbField;
    var arautoc;
    if (menu.getAttribute(menu.cfid, "acField")) {
        arautocmbField = menu.getAttribute(menu.cfid, "acField").mInputNode.getAttribute("arautocmb");
        arautoc = menu.getAttribute(menu.cfid, "acField").mInputNode.getAttribute("arautoc")
    } else {
        arautocmbField = "0";
        arautoc = "0"
    }
    var arautocmb = arautocmbField == null ? "": arautocmbField;
    var req = new NDXExpandMenu(windowID, menu_name, server, ARKWGetStringByIdx(windowID, 6), rs, rf, q.qual, filter, arautoc, arautocmb, q.fieldids, q.fieldvals, q.fieldtypes, fieldids, fieldvals, fieldtypes, keyids, keyvals, keytypes);
    var res = req.result;
    return res
}
function getMenuData(d, g, b, k, f) {
    if ("armfid" in b) {
        var h = new MenuParser(d, b);
        return h.getMenuDef()
    }
    return getMenuDataFromRequest(d, g, b, k, f)
}
function ARMenu_Get(g, p, b, d) {
    var k = getARMenuCache_NS(g);
    if (! (p in k)) {
        k[p] = null;
        var h = ((b) ? b: ARKWGetStringByIdx(g, 7));
        new NDXGetMenuDefinition(g, p, h)
    }
    if (k[p] == null) {
        handleMenuAbsent(p);
        return
    }
    var s = !(p in k);
    var q = s ? null: k[p].mCharFieldMenu;
    if (q == null) {
        var o = k[p].mMenuData;
        res = getMenuData(g, p, o, b, d);
        var f = getARMenuCache_NS(g)[p];
        if (f.cfid) {
            f.setAttribute(f.cfid, "tItems", parseInt(res.tItems))
        }
        q = new CharFieldMenu(g, res);
        if ("q" in o) {
            ARKWSetLASTCOUNT(g, q.mQueryReturnedNoValues ? 0 : res.mval.length)
        }
        if ("r" in o && o.r == 1) {
            f.mCharFieldMenu = q
        }
    } else {
        var f = ARMenu.getMenu(g, p);
        if (f == null) {
            handleMenuAbsent(p);
            return
        }
        f.setState(3)
    }
    return q
}
function handleMenuAbsent(b) {
    window.status = getLocalizedMessage("Menu " + b + " is invalid.")
}
function ARMenu_Open(q, h, o, s) {
    var f = q.windowID;
    var k;
    if (h != "") {
        var d = getARMenuCache_NS(f)[h];
        if (d == null) {
            new NDXGetMenuDefinition(q.windowID, h, ARKWGetStringByIdx(q.windowID, 7));
            d = getARMenuCache_NS(f)[h];
            d.cfid = q.mID;
            d.addField(q.mID)
        }
        if (d == null) {
            handleMenuAbsent(h);
            return
        }
        if (!d.cfid) {
            d.cfid = q.mID;
            d.addField(q.mID)
        }
        k = ARMenu_Get(f, h);
        d.setState(3);
        d.getAttribute(d.cfid, "isLoadByMenu", true);
        d.setAttribute(d.cfid, "arautocak", 0);
        var g;
        var b;
        if (d.getAttribute(d.cfid, "acField")) {
            b = d.getAttribute(d.cfid, "acField").mInputNode.getAttribute("arautoc");
            g = d.getAttribute(d.cfid, "acField").mInputNode.getAttribute("arautocmb")
        } else {
            b = "0";
            g = "0"
        }
        var u = (g != null) && (g == "1");
        var p = new Object();
        p.acLabelLengths = new Array();
        p.acLabels = new Array();
        p.acValues = new Array();
        appendMenuLeafPathElements(k.mMenuDef, "", p, u);
        if (p != null) {
            actb_values = (p.acValues != null) ? p.acValues: new Array();
            actb_keywords = (p.acLabels != null) ? p.acLabels: p.acValues;
            actb_lengths = (p.acLabelLengths != null) ? p.acLabelLengths: new Array();
            d.getAttribute(d.cfid, "ac_kw_len", actb_keywords.length)
        }
    } else {
        k = getNoEntryMenu(f)
    }
    if (k) {
        if (k.mMenuDef.length > 0) {
            if (isNoEntryMenu(k)) {
                s = false
            }
            return {
                n: {
                    f: k.Open,
                    t: k,
                    a: [q, o, s]
                }
            }
        } else {
            window.status = getLocalizedMessage("No Menu Items to Display", null, "Menu Open")
        }
    } else {
        window.status = getLocalizedMessage("No Menu to Display", null, "Menu Open")
    }
}
function isNoEntryMenu(b) {
    if (b.mMenuDef.length == 1) {
        var f = b.mMenuDef[0].l.ValidatorUnEscape();
        var d = getLocalizedMessage("(no entries in menu)");
        if (f == d) {
            return true
        }
    }
    return false
}
function getNoEntryMenu(b) {
    var f = {};
    f.novals = true;
    var d = getLocalizedMessage("(no entries in menu)");
    f.mval = new Array();
    f.mval[0] = {
        l: d,
        v: null
    };
    return new CharFieldMenu(b, f)
}
MenuParser.prototype.constructor = MenuParser;
function MenuParser(g, d) {
    this.windowID = g;
    this.menuDef = null;
    this.MLABELVALUEDELIM = "\\";
    this.MSUBDELIM = "\t";
    this.MCOMMENT = "#";
    this.retARerr = 0;
    this.maxLevel = 0;
    var k = d.armfid;
    var b = null;
    var h = getFields_NS(g)[k];
    if (h != null) {
        if ("GetScreenValAsPrimitive" in h) {
            b = h.GetScreenValAsPrimitive()
        } else {
            b = h.G();
            b = b.toString()
        }
    }
    if (b == null || b.length == 0) {
        this.menuStr = null
    } else {
        this.menuStr = b;
        this.parseMenuData()
    }
}
MenuParser.prototype.subLevels = function(f) {
    var h = f;
    var g = 0;
    var d = true;
    var b = 0;
    while (d) {
        b = h.indexOf(this.MSUBDELIM, b);
        if (b == -1) {
            d = false
        } else {
            b++;
            g++
        }
    }
    return g
};
MenuParser.prototype.menuTrim = function(d) {
    var f = d;
    f = f.replace(/^[ ]+/, "");
    for (var b = f.length - 1; b >= 0; b--) {
        if (f.charAt(b) == " ") {
            f = f.substring(0, b)
        } else {
            break
        }
    }
    return f
};
MenuParser.prototype.parseMenuData = function() {
    this.maxLevel = 0;
    var f = this.menuStr;
    f = f.replace(/\r\n/g, "\n");
    var p = f.split("\n");
    var h = new Array();
    var k = 0;
    var q = 0;
    for (var g = 0; g < p.length; g++) {
        if (p[g].length == 0) {
            continue
        }
        if (p[g].indexOf(this.MCOMMENT) == 0) {
            continue
        }
        var o = p[g].indexOf(this.MLABELVALUEDELIM);
        var d = new Array();
        if (o >= 0) {
            d[0] = p[g].substring(0, o);
            d[0] = this.menuTrim(d[0]);
            d[1] = (o + 1 == p[g].length) ? "": p[g].substring(o + 1);
            d[1] = this.menuTrim(d[1]);
            if (d[1].length <= 0) {
                d[1] = undefined
            }
        } else {
            d[0] = this.menuTrim(p[g])
        }
        var b = this.subLevels(d[0]);
        d[0] = d[0].trim(1);
        if (d[0].length <= 0) {
            continue
        }
        if (g == 0 && b > 0) {
            this.retARerr = 130;
            return
        }
        if (b > 0 && b == q + 1) {
            q = b
        } else {
            if (b > 0 && b < q) {
                q = b
            } else {
                if (b == 0) {
                    q = 0
                } else {
                    if (b == q) {} else {
                        continue
                    }
                }
            }
        }
        if (q > 15) {
            this.retARerr = 321;
            return
        }
        if (q > this.maxLevel) {
            this.maxLevel = q
        }
        var s = new Object();
        s.level = q;
        s.l = d[0];
        s.v = (d.length > 1) ? d[1] : d[0];
        h[k++] = s
    }
    this.maxLevel++;
    if (h.length > 0) {
        this.menuDef = h
    } else {
        this.menuStr = null
    }
};
MenuParser.prototype.getMenuStruct = function() {
    var p = new Array(this.maxLevel);
    for (var h = 0; h < this.maxLevel; h++) {
        p[h] = -1
    }
    var g = new Array(this.maxLevel);
    for (var f = 0; f < this.maxLevel; f++) {
        g[f] = null
    }
    var q = new Object();
    var s = new Array();
    q.novals = false;
    q.mval = s;
    g[0] = q.mval;
    var d = 0;
    for (var k = 0; k < this.menuDef.length; k++) {
        var o = this.menuDef[k].level;
        var u = new Object();
        if (o > d) {
            u.l = this.menuDef[k].l;
            u.v = this.menuDef[k].v;
            var b = o - 1;
            p[o]++;
            g[o] = new Array();
            g[b][p[b]].v = g[o];
            g[b][p[b]].v[p[o]] = u;
            d = o
        } else {
            if (d > 0 && o == d) {
                u.l = this.menuDef[k].l;
                u.v = this.menuDef[k].v;
                var b = o - 1;
                p[o]++;
                g[b][p[b]].v[p[o]] = u
            } else {
                p[o]++;
                u.l = this.menuDef[k].l;
                u.v = this.menuDef[k].v;
                g[o][p[o]] = u;
                if (o < d) {
                    for (var v = d; v > o; v--) {
                        p[v] = -1
                    }
                }
                d = o
            }
        }
    }
    return q
};
MenuParser.prototype.genNoEntryMenu = function() {
    var d = new Object();
    d.novals = true;
    var b = getLocalizedMessage("(no entries in menu)");
    d.mval = new Array();
    d.mval[0] = {
        l: b,
        v: null
    };
    return d
};
MenuParser.prototype.getMenuRes = function() {
    if (this.menuStr == null) {
        return this.genNoEntryMenu()
    } else {
        if (this.retARerr != 0) {
            var b = "error " + this.retARerr;
            switch (this.retArerr) {
            case 130:
                b = getLocalizedMessage("Error with an entry in the character menu");
                break;
            case 383:
                b = getLocalizedMessage("File menu contains too many items on one level (maximum 1000)");
                break
            }
            if (getCurWFC_NS(this.windowID) != null) {
                getCurWFC_NS(this.windowID).status([{
                    cId: 0,
                    t: 2,
                    m: b,
                    n: this.retArerr,
                    a: null
                }])
            }
            if (getCurWFC_NS(this.windowID) != null) {
                getCurWFC_NS(this.windowID).status([])
            }
        } else {
            return this.getMenuStruct()
        }
    }
};
MenuParser.prototype.getMenuDef = function() {
    return this.getMenuRes()
};
function StatusHistoryPopup(b, f, d) {
    return weOpenModalPopup(b, (AbsContextPath + "resources/html/StatusHistoryPopup.html"), "StatusHistory", {
        title: f,
        history: d,
        appss: GetAppStyleSheet("../../")
    },
    {},
    [512, 200])
}
JMenuItem.prototype = new Field();
JMenuItem.prototype.constructor = JMenuItem;
JMenuItem.superclass = Field.prototype;
function JMenuItem(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
JMenuItem.prototype.init = function(h, g, f) {
    JMenuItem.superclass.init.call(this, h, g, f);
    this.SVis((this.mObj.v == 1) ? true: false);
    this.SAccess(this.mObj.s);
    var k = "artbl" + this.mObj.pnt;
    if (typeof getARMenus_NS(h)[k] == "undefined") {
        getARMenus_NS(h)[k] = []
    }
    var d = getARMenus_NS(h)[k];
    if (typeof d[this.mObj.mp] == "undefined") {
        d[this.mObj.mp] = []
    }
    d[this.mObj.mp][this.mObj.p] = this.mID
};
DControl.prototype = new Field();
DControl.prototype.constructor = DControl;
DControl.superclass = Field.prototype;
JControl.prototype = new Field();
JControl.prototype.constructor = JControl;
JControl.superclass = Field.prototype;
TPAControl.prototype = new Field();
TPAControl.prototype.constructor = TPAControl;
TPAControl.superclass = Field.prototype;
DOMFieldFactories.Control = function(b, f, d) {
    return new DControl(b, f, d)
};
function DControl(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DControl.prototype.mDOMField = DControl.prototype.mHaveVisualCharacteristics = true;
DControl.prototype.init = function(g, f, d) {
    DControl.superclass.init.call(this, g, f, d);
    if (this.mObj.firstChild) {
        for (var h = this.mObj.firstChild; h; h = h.nextSibling) {
            if (h.nodeType == 1 && h.className.indexOf("btntextdiv") != -1) {
                this.mTextElement = h.firstChild;
                return
            }
        }
    }
};
var FormActionButtonFlags = {
    1001 : {
        c: (1 << 4) | (1 << 2) | (1 << 5) | (1 << 3) | (1 << 6),
        f: FormAction_Submit
    },
    1002 : {
        c: (1 << 1) | (1 << 2) | (1 << 5) | (1 << 3) | (1 << 6),
        f: FormAction_Query
    },
    1003 : {
        c: (1 << 1) | (1 << 4) | (1 << 2) | (1 << 3),
        f: FormAction_Modify
    },
    1006 : {
        c: (1 << 5) | (1 << 3) | (1 << 6),
        f: FormAction_Clear
    },
    1007 : {
        c: (1 << 5) | (1 << 2) | (1 << 3) | (1 << 6),
        f: FormAction_SetToDefaults
    },
    1008 : {
        c: 0,
        f: FormAction_ShowHelp
    },
    1009 : {
        c: (1 << 2),
        f: FormAction_NewSearch
    },
    1010 : {
        c: (1 << 2),
        f: FormAction_NewRequest
    },
    1011 : {
        c: (1 << 1) | (1 << 4) | (1 << 2) | (1 << 6),
        f: FormAction_ShowStatusHistory
    },
    1012 : {
        c: 0,
        f: FormAction_OpenHomePage
    },
    1004 : {
        c: (1 << 1) | (1 << 4) | (1 << 2) | (1 << 3),
        f: FormAction_ModifyAll
    },
    1013 : {
        c: 0,
        f: FormAction_SavedSearches
    },
    1014 : {
        c: 0,
        f: FormAction_QuickReports
    }
};
var ApplyButtonIDs = {
    1 : 1001,
    5 : 1003,
    6 : 1003
};
DControl.prototype.Clear = function() {};
DControl.prototype.MouseSelectable = false;
DControl.prototype.UpdateAccess = function(f, d) {
    if (this.mID in FormActionButtonFlags && !d && (FormActionButtonFlags[this.mID].c & (1 << getARStateCurrent_NS(this.windowID)))) {
        return
    }
    if (d) {
        this.mCFCache.a = f
    }
    var b = (f == 3);
    if (f == 1) {
        if ((typeof this.mID != "undefined") && (typeof getDefaults_NS(this.windowID)[this.mID] != "undefined") && (typeof getDefaults_NS(this.windowID)[this.mID].a != "undefined")) {
            b = (getDefaults_NS(this.windowID)[this.mID].a == 3)
        }
    }
    FakeButton_SetDisable(this.mObj, b)
};
DControl.prototype.GetFocusElement = function() {
    return this.mObj
};
DControl.prototype.GetFocusElementForEvent = function(b) {
    if (this.GetNestedFocusability()) {
        return this.mObj
    }
    return null
};
DControl.prototype.ResizeTo = function(d, b) {};
DControl.prototype.mHaveStoredData = false;
function DControl_UpdateFormActionButtons(b) {
    if (typeof rtfEditor != "undefined" && rtfEditor && rtfEditor.IsVisible()) {
        rtfEditor.Close(false)
    }
    var f = 0;
    for (var h in FormActionButtonFlags) {
        if (h in getFields_NS(b)) {
            f = (1 << getARStateCurrent_NS(b));
            var d = ((FormActionButtonFlags[h].c & (f)) == 0);
            if (h == 1011 && !getFields_NS(b)[15]) {
                d = false
            } else {
                if (h == 1003 && getFields_NS(b)[h].mObj.className.indexOf("btnd") != -1) {
                    d = false
                }
            }
            getFields_NS(b)[h].UpdateAccess(d ? 2 : 3, true)
        }
    }
    var g = true;
    if ((getFields_NS(b)[1003]) && (f == 32) && (getFields_NS(b)[1003].mObj.className.indexOf("btnd") == -1)) {
        d = true;
        getFields_NS(b)[1003].UpdateAccess(d ? 2 : 3, true);
        g = false
    } else {
        if ((getFields_NS(b)[1001]) && (f == 2)) {
            d = true;
            getFields_NS(b)[1001].UpdateAccess(d ? 2 : 3, true)
        }
    }
    if ("Toolbar_UpdateFormActionButtons" in window) {
        Toolbar_UpdateFormActionButtons(b)
    }
    if (g) {
        DControl_DirtyFlagChanged(b, getFieldChanged_NS(b))
    }
}
function DControl_DirtyFlagChanged(b, d) {
    var f = ApplyButtonIDs[getARStateCurrent_NS(b)];
    if (f) {
        F(b, f).UpdateAccess(d ? 2 : 3, true)
    }
    if ("Toolbar_DirtyFlagChanged" in window) {
        Toolbar_DirtyFlagChanged(b, d)
    }
}
JFieldFactories.Control = function(b, f, d) {
    return new JControl(b, f, d)
};
function JControl(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAFieldFactories.Control = function(b, f, d) {
    return new TPAControl(b, f, d)
};
function TPAControl(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAControl.prototype.DOMMouseOver = JControl.prototype.DOMMouseOver = DControl.prototype.DOMMouseOver = function(b) {
    return hoverState.eventMouseOver(b)
};
TPAControl.prototype.DOMMouseMove = JControl.prototype.DOMMouseMove = DControl.prototype.DOMMouseMove = function(b) {
    return hoverState.eventMouseMove(b)
};
TPAControl.prototype.DOMMouseOut = JControl.prototype.DOMMouseOut = DControl.prototype.DOMMouseOut = function(b) {
    return hoverState.eventMouseOut(b)
};
DControl.prototype.DOMClick = function(d) {
    hoverState.clearTracking();
    if (this.GAccess() == 3) {
        return
    }
    var b = [];
    if (this.mID in FormActionButtonFlags) {
        b.push({
            f: FormActionButtonFlags[this.mID].f,
            a: [this.windowID]
        })
    }
    var f = this.windowID;
    b.push({
        f: function() {
            hoverState.btnClickE()
        }
    });
    b.push({
        f: ExecuteWorkflow,
        a: [f, 1, this.mID]
    });
    b.push({
        f: function() {
            hoverState.btnClickS(d)
        }
    });
    if (this.mID in FormActionButtonFlags) {
        return getCurWFC_NS(this.windowID).executeAll(b)
    } else {
        return {
            n: b
        }
    }
};
TPAControl.prototype.DOMClick = function(d, g) {
    hoverState.clearTracking();
    if (this.GAccess() == 3) {
        return
    }
    var b = [];
    if (g in FormActionButtonFlags) {
        b.push({
            f: FormActionButtonFlags[g].f,
            a: [this.windowID]
        })
    }
    var f = this.windowID;
    b.push({
        f: function() {
            hoverState.btnClickE()
        }
    });
    b.push({
        f: ExecuteWorkflow,
        a: [this.windowID, 1, g]
    });
    b.push({
        f: function() {
            hoverState.btnClickS(d)
        }
    });
    if (g in FormActionButtonFlags) {
        return getCurWFC_NS(this.windowID).executeAll(b)
    } else {
        return {
            n: b
        }
    }
};
DNavBarItem.prototype = new Field();
DNavBarItem.prototype.constructor = DNavBarItem;
DNavBarItem.superclass = Field.prototype;
var NavItemFactories = {};
DOMFieldFactories.NavBarItem = function(b, f, d) {
    return new DNavBarItem(b, f, d)
};
function DNavBarItem(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DNavBarItem.prototype.mDOMField = DNavBarItem.prototype.mHaveVisualCharacteristics = true;
DNavBarItem.prototype.init = function(g, f, d) {
    DNavBarItem.superclass.init.call(this, g, f, d);
    this.mNavMode = this.mObj.getAttribute("navmode");
    if (!this.mNavMode) {
        this.mNavMode = 0
    }
    this.mViewTypeObj = NavItemFactories[this.mNavMode](this);
    this.mViewTypeObj.getStyleFromChildOf = function(o, k) {
        if (o) {
            var q = null;
            var p = null;
            var h = o.getElementsByTagName("span");
            for (var b = 0; b < h.length; b++) {
                p = h[b];
                q = (document.defaultView.getComputedStyle(p, null).getPropertyValue(k));
                if (q) {
                    return colorValue(q)
                }
            }
        }
        return null
    }
};
DNavBarItem.prototype.Clear = function() {};
DNavBarItem.prototype.DOMClick = function(b) {
    return this.mViewTypeObj.DOMClick(b)
};
DNavBarItem.prototype.SetSelected = function() {
    this.mViewTypeObj.SetSelected()
};
DNavBarItem.prototype.setStyle = function(b) {
    this.mViewTypeObj.setStyle(b)
};
DNavBarItem.prototype.Reset = function(b) {
    this.mViewTypeObj.Reset(b)
};
DNavBarItem.prototype.MakeItemVisible = function() {
    this.mViewTypeObj.MakeItemVisible()
};
DNavBarItem.prototype.DOMMouseOver = function(b) {
    this.mViewTypeObj.DOMMouseOver(b)
};
DNavBarItem.prototype.DOMMouseMove = function(b) {
    this.mViewTypeObj.DOMMouseMove(b)
};
DNavBarItem.prototype.DOMMouseOut = function(b) {
    this.mViewTypeObj.DOMMouseOut(b)
};
DNavBarItem.prototype.UpdateVis = function(b) {
    this.mViewTypeObj.UpdateVis(b)
};
DNavBarItem.prototype.MouseSelectable = false;
DNavBarItem.prototype.UpdateAccess = function(b) {
    this.mViewTypeObj.UpdateAccess(b)
};
DNavBarItem.prototype.GetFocusElement = function() {
    return this.mViewTypeObj.GetFocusElement()
};
DNavBarItem.prototype.GetFocusElementForEvent = function(b) {
    return this.mViewTypeObj.GetFocusElementForEvent(b)
};
DNavBarItem.prototype.mHaveStoredData = false;
DNavBarItem.prototype.mContainFields = true;
DNavBarItem.prototype.TabableElementSelector = function(b) {
    return this.mViewTypeObj.TabableElementSelector(b)
};
DNavBarItem.prototype.GetNestedFocusability = function() {
    if (this.GAccess() == 3 || this.mObj.getAttribute("separator") == 1) {
        return false
    }
    if (typeof this.mID == "number") {
        return DNavBarItem.superclass.GetNestedFocusability.call(this)
    }
    return null
};
function getGradientImage(d, b) {
    var f = document.createElement("IMG");
    d.appendChild(f);
    f.className = "GrImg";
    f.alt = "";
    f.src = b
}
DNavBarItem.prototype.GColour = function() {
    return this.mViewTypeObj.GColour()
};
DNavBarItem.prototype.UpdateColour = function(b) {
    this.mViewTypeObj.UpdateColour(b);
    if (this.mNavMode == 1 && b) {
        DNavBarItem.superclass.UpdateColour.call(this, b)
    }
};
DNavBarItem.prototype.UpdateLabel = function(b) {
    this.mViewTypeObj.UpdateLabel(b);
    DNavBarItem.superclass.UpdateLabel.call(this, b)
};
DNavBarItem.prototype.UpdateFont = function(b) {
    this.mViewTypeObj.UpdateFont(b);
    DNavBarItem.superclass.UpdateFont.call(this, b)
};
DNavBarItem.prototype.SetStatus = function(b) {
    this.mViewTypeObj.SetStatus(b)
};
TradNavItem.prototype.constructor = TradNavItem;
NavItemFactories["0"] = function(b) {
    return new TradNavItem(b)
};
function TradNavItem(b) {
    if (arguments.length) {
        this.init(b)
    }
}
TradNavItem.prototype.mDOMField = TradNavItem.prototype.mHaveVisualCharacteristics = true;
TradNavItem.prototype.init = function(k) {
    this.mParentObj = k;
    this.mObj = k.mObj;
    this.mID = k.mID;
    this.mStatus = this.mObj.getAttribute("status");
    var f = this.mObj.parentNode;
    var h = this.mObj;
    if (h.className.indexOf("VNavLevel1") != -1) {
        if (h.getAttribute("gcolor") != null && h.getAttribute("color") != null && h.getAttribute("gtype") != null) {
            var g = h.getAttribute("gcolor");
            var o = h.getAttribute("color");
            var b = h.getAttribute("gtype");
            var d = RelContextPath + "bmc_border.gif?c=" + o + "&g=" + g + "&t=" + b;
            getGradientImage(h, d)
        }
    }
    while (f != null && (f.tagName == "DIV" || f.tagName == "DL")) {
        if (f.getAttribute("artype") == "VertNavBar" || f.getAttribute("artype") == "HorzNavBar") {
            this.mContainer = F(this.mParentObj.windowID, f.getAttribute("arid"));
            break
        }
        f = f.parentNode
    }
    if (this.mStatus != null) {
        if (this.mObj.nextSibling != null && this.mObj.nextSibling.getAttribute("id") == ("sub-" + this.mID)) {
            this.mChildObj = this.mObj.nextSibling
        }
        this.mParentObj.mTextElement = this.mObj.childNodes[0]
    } else {
        if (f != null && f.getAttribute("artype") == "HorzNavBar") {
            this.mParentObj.mTextElement = this.mObj.childNodes[1].childNodes[0]
        } else {
            this.mParentObj.mTextElement = this.mObj.childNodes[0]
        }
        if (this.mParentObj.mTextElement != null && this.mParentObj.mTextElement.nodeType != 1) {
            this.mParentObj.mTextElement = null
        }
        if (this.mObj.className.match(/\S*NavSelected\S*/) != null) {
            this.MakeItemVisible()
        }
    }
};
TradNavItem.prototype.DOMClick = function(d) {
    hoverState.clearTracking();
    if (typeof d != "undefined") {
        d.StopBubbling();
        d.StopDefault()
    }
    if (this.mParentObj.GAccess() == 3 || this.mObj.getAttribute("separator") == 1) {
        return
    }
    this.DOMMouseOut(null);
    if (this.mStatus != null) {
        this.SetStatus(this.mStatus == "open" ? "close": "open")
    }
    var b = (this.mContainer.GetSelected() == this.mID) ? this.mContainer.FireWorkflowOnSelectedItem() : true;
    if (this.mContainer.SelectItemOnClick()) {
        this.mContainer.SetSelected(this)
    }
    if (b) {
        var f = {
            f: ExecuteWorkflow,
            a: [this.mParentObj.windowID, 1, this.mID]
        };
        return {
            c: f
        }
    }
};
TradNavItem.prototype.SetSelected = function() {
    if (this.mObj.getAttribute("status") == null && this.mObj.getAttribute("separator") != 1) {
        this.mContainer.SetSelected(this);
        this.MakeItemVisible()
    }
};
TradNavItem.prototype.MakeItemVisible = function() {
    var b, d = this.mObj.getAttribute("parentid");
    while (d != null && d > 0) {
        b = F(this.mParentObj.windowID, d);
        if (b instanceof DNavBarItem) {
            b.SetStatus("open")
        }
        d = b.mObj.getAttribute("parentid")
    }
};
TradNavItem.prototype.setStyle = function(d) {
    if (this.mObj.className.indexOf("VNavParent") != -1) {
        return
    }
    var b = (this.mObj.getAttribute("type") == "vert" ? " VNavHover": " HNavHover");
    if (this.mObj.className.indexOf("VNavSelected") != -1) {
        b = " VNavSelectedHover"
    }
    if (d) {
        this.mObj.className = this.mObj.className + b
    } else {
        this.mObj.className = this.mObj.className.replace(b, "")
    }
};
TradNavItem.prototype.DOMMouseOver = function(b) {
    hoverState.eventMouseOver(b);
    if (this.mParentObj.GAccess() == 3 || this.mObj.getAttribute("separator") == 1) {
        return
    }
    this.setStyle(true)
};
TradNavItem.prototype.DOMMouseMove = function(b) {
    hoverState.eventMouseMove(b)
};
TradNavItem.prototype.DOMMouseOut = function(b) {
    hoverState.eventMouseOut(b);
    if (this.mParentObj.GAccess() == 3 || this.mObj.getAttribute("separator") == 1) {
        return
    }
    this.setStyle(false)
};
TradNavItem.prototype.SetStatus = function(d) {
    var h = this.mObj.firstChild;
    var k = "&#9660";
    var g = "&#9658";
    var o = h.firstChild;
    if (this.mStatus != "open" && d == "open") {
        this.mStatus = "open";
        o.innerHTML = "";
        var u = "\u25BC";
        var s = document.createTextNode(u);
        o.appendChild(s);
        this.mChildObj.style.visibility = "inherit";
        var q = this.mParentObj.GetParent();
        var b = F(this.mParentObj.windowID, q.mContainerID);
        while (b) {
            if (b instanceof DPage && b.mFillModel && b.mState == 1 && b.mFit) {
                b.getChildScroll(q)
            }
            b = b.GetParent()
        }
        if (typeof AnimMgr != "undefined") {
            var f = this.mChildObj;
            setTimeout(function() {
                AnimMgr.WipeInNav(f)
            },
            100)
        } else {
            this.mChildObj.style.display = "block"
        }
    } else {
        if (this.mStatus != "close" && d == "close") {
            this.mStatus = "close";
            o.innerHTML = "";
            var u = "\u25BA";
            var s = document.createTextNode(u);
            o.appendChild(s);
            if (typeof AnimMgr != "undefined") {
                AnimMgr.WipeOutNav(this.mChildObj)
            } else {
                this.mChildObj.style.display = "none";
                this.mChildObj.style.visibility = "hidden"
            }
        }
    }
};
TradNavItem.prototype.UpdateVis = function(b) {
    if (!this.mHaveVisualCharacteristics || (b && this.mObj.style.visibility == "inherit") || (!b && this.mObj.style.visibility == "hidden")) {
        return
    }
    if (this.mChildObj != null && this.mStatus == "open") {
        this.mChildObj.style.display = (b ? "block": "none");
        this.mChildObj.style.visibility = (b ? "inherit": "hidden")
    }
    if (this.mObj.getAttribute("type") == "vert") {
        this.mObj.style.display = (b ? "block": "none")
    } else {
        this.mObj.style.display = (b ? "inline": "none")
    }
    this.mObj.style.visibility = (b ? "inherit": "hidden")
};
TradNavItem.prototype.MouseSelectable = false;
TradNavItem.prototype.UpdateAccess = function(d) {
    var b = (this.mObj.getAttribute("type") == "vert" ? " VNavDisabled": " HNavDisabled");
    if (d == 3) {
        this.mObj.className += b;
        if (this.mStatus == "open") {
            this.SetStatus("close")
        }
    } else {
        this.mObj.className = this.mObj.className.replace(b, "")
    }
    this.mParentObj.mCFCache.a = d
};
TradNavItem.prototype.GetFocusElement = function() {
    return this.mObj
};
TradNavItem.prototype.GetFocusElementForEvent = function(b) {
    if (this.GetNestedFocusability()) {
        return this.mObj
    }
    return null
};
TradNavItem.prototype.TabableElementSelector = function(b) {
    if (b.tagName == "A") {
        if (!b.style || b.style.visibility != "hidden") {
            return b
        }
    }
    return null
};
TradNavItem.prototype.GetNestedFocusability = function() {
    return this.mParentObj.GetNestedFocusability()
};
TradNavItem.prototype.GColour = function() {
    return this.getStyleFromChildOf(this.mObj, "color")
};
TradNavItem.prototype.UpdateColour = function(f) {
    if (f) {
        var d = this.mObj.getElementsByTagName("span");
        for (var b = 0; b < d.length; b++) {
            d[b].style.color = f
        }
    }
};
TradNavItem.prototype.UpdateLabel = function(d) {
    if (this.mContainer instanceof DVertNavBar) {
        var b = this.mObj.getElementsByTagName("span");
        if (b.length == 2) {
            this.mParentObj.mTextElement = b[1]
        } else {
            this.mParentObj.mTextElement = b[0]
        }
    }
};
TradNavItem.prototype.UpdateFont = function(d) {
    if (this.mContainer instanceof DVertNavBar) {
        var b = this.mObj.getElementsByTagName("span");
        if (b.length == 2) {
            this.mParentObj.mTextElement = b[1]
        } else {
            this.mParentObj.mTextElement = b[0]
        }
    }
};
FlyoutItem.prototype.constructor = FlyoutItem;
NavItemFactories["1"] = function(b) {
    return new FlyoutItem(b)
};
function FlyoutItem(b) {
    if (arguments.length) {
        this.init(b)
    }
}
FlyoutItem.prototype.mDOMField = FlyoutItem.prototype.mHaveVisualCharacteristics = true;
FlyoutItem.prototype.init = function(k) {
    this.mParentObj = k;
    this.mObj = k.mObj;
    this.mID = k.mID;
    this.mStatus = this.mObj.getAttribute("status");
    this.mNavMode = this.mObj.getAttribute("navmode");
    this.mLevel = this.mObj.getAttribute("lvl");
    var f = this.mObj.parentNode.parentNode;
    var h = this.mObj;
    if (h.className.indexOf("VNavLevel1") != -1) {
        if (h.getAttribute("gcolor") != null && h.getAttribute("color") != null && h.getAttribute("gtype") != null) {
            var g = h.getAttribute("gcolor");
            var o = h.getAttribute("color");
            var b = h.getAttribute("gtype");
            var d = RelContextPath + "bmc_border.gif?c=" + o + "&g=" + g + "&t=" + b;
            getGradientImage(h, d)
        }
    }
    while (f != null && (f.tagName == "DIV")) {
        if ((f.getAttribute("artype") == "VertNavBar") || (f.getAttribute("artype") == "AppList")) {
            this.mContainer = F(this.mParentObj.windowID, f.getAttribute("arid"));
            break
        }
        f = f.parentNode
    }
    if (this.mStatus != null) {
        this.mNeedToScroll = false;
        this.mTextElement = this.mObj.childNodes[0].childNodes[0];
        this.mChildObj = this.mObj.childNodes[1]
    } else {
        this.mTextElement = this.mObj.childNodes[0].childNodes[0];
        if (this.mTextElement != null && this.mTextElement.nodeType != 1) {
            this.mTextElement = null
        }
    }
    this.mParentObj.mTextElement = this.mTextElement
};
var EXTENSION_HEIGHT = 25;
FlyoutItem.prototype.CreateExtensions = function() {
    if (this.mNeedToScroll) {
        return
    }
    var q = ComputeElementPosition(this.mObj, getFormElements_NS(this.mParentObj.windowID)["FormContainer"], 0, 0);
    var s = q.y;
    var w = this.mObj.childNodes[1].firstChild;
    this.mRowCnt = 0;
    if (w == null) {
        this.mRowCnt = 0;
        this.mRowH = 0;
        return - 1
    }
    this.mRowH = w.offsetHeight;
    if (w.parentNode.childNodes.length > 0) {
        this.mRowCnt = w.parentNode.childNodes.length / 2
    }
    if (this.mRowH == 0) {
        this.mRowH = 25
    }
    this.mH = this.mRowCnt * this.mRowH;
    var d = 25;
    this.mNeedToScroll = true;
    var f = this.mObj.childNodes[1];
    var u = getFormElements_NS(this.mParentObj.windowID)["FormContainer"].scrollTop;
    var p = getFormElements_NS(this.mParentObj.windowID)["FormContainer"].clientHeight + u;
    var h = p - u;
    var g = 1;
    if (s < (h / 2)) {
        h = h - s;
        g = 0
    } else {
        h = s
    }
    var v = this.mH < h ? this.mH: h;
    if (this.mH > v) {
        var b = v - 2 - EXTENSION_HEIGHT;
        if (b < this.mRowH) {
            b = this.mRowH
        }
        b -= b % this.mRowH;
        this.mRowsPerScreen = Math.floor((b) / this.mRowH);
        var o = new Array();
        createFlyout(f, this.mRowsPerScreen * 2, this.mRowsPerScreen * 2, f, o, false);
        for (var k = 0; k < o.length; k++) {
            f.removeChild(o[k])
        }
        setHandlers(this.mParentObj.windowID, this.mObj);
        FlyoutReInit(this.mParentObj.windowID, this.mObj)
    }
    return g
};
function createFlyout(g, d, v, b, p, s) {
    var w = d + v;
    if ((w + 1) == g.childNodes.length) {
        w += 1
    }
    var k;
    var h;
    if (s) {
        k = 0;
        h = "root"
    } else {
        k = g.childNodes[0].getAttribute("lvl");
        k = parseInt(k, 10) % 2;
        h = "lvl" + k
    }
    var q = document.createElement("a");
    q.className = "btn";
    q.href = "javascript:";
    q.style.zIndex = "1";
    var A = document.createElement("span");
    A.className = "navLabel " + h;
    A.innerHTML = "Show Next >>>";
    q.appendChild(A);
    var C = document.createElement("DIV");
    C.style.overflow = "visible";
    C.className = "flyout";
    C.style.borderRight = "1px solid #196697";
    C.style.left = 0;
    C.style.zIndex = g.childNodes[0].style.zIndex;
    var f = 0;
    for (var o = d; o < w; o++) {
        if (o < g.childNodes.length && g.childNodes[o].tagName == "DIV") {
            var B = g.childNodes[o].cloneNode(true);
            C.appendChild(B);
            p.push(g.childNodes[o]);
            f++
        }
    }
    var y = v / 2 - f;
    if (y > 0) {
        C.appendChild(createDummyItems(h, k, y + 1))
    }
    if (w < g.childNodes.length) {
        createFlyout(g, w, v, C, p)
    }
    var u = document.createElement("DIV");
    u.className = "ext item " + h;
    u.style.overflow = "visible";
    u.style.height = g.childNodes[0].clientHeight;
    C.style.zIndex = g.childNodes[0].style.zIndex;
    C.style.backgroundColor = g.childNodes[0].style.backgroundColor;
    u.setAttribute("lvl", k);
    u.appendChild(q);
    u.appendChild(C);
    b.appendChild(u)
}
function createDummyItems(f, b, d) {
    var g = document.createElement("DIV");
    g.className = "dummy item " + f;
    g.style.overflow = "visible";
    g.style.height = 25 * d + "px";
    g.setAttribute("lvl", b);
    return g
}
function FlyoutReInit(b, g) {
    var f = g;
    while (1) {
        var d;
        if (f.nodeType == 1 && (d = f.getAttribute("arid"))) {
            getFields_NS(b)[d].Reset(f)
        }
        if (f.firstChild) {
            f = f.firstChild
        } else {
            while (!f.nextSibling) {
                f = f.parentNode;
                if (f == g) {
                    return
                }
            }
            f = f.nextSibling
        }
    }
}
FlyoutItem.prototype.Reset = function(b) {
    this.mObj = b;
    this.mTextElement = this.mObj.childNodes[0].childNodes[0];
    this.mParentObj.mTextElement = this.mTextElement;
    if (this.mStatus != null) {
        this.mChildObj = this.mObj.childNodes[1]
    }
};
FlyoutItem.prototype.DOMClick = function(d) {
    if (d.element.nodeType == 1) {
        hoverState.clearTracking()
    }
    if (typeof d != "undefined") {
        d.StopBubbling();
        d.StopDefault()
    }
    if (this.mParentObj.GAccess() == 3 || this.mObj.getAttribute("separator") == 1) {
        return
    }
    this.DOMMouseOut(null);
    if (this.mStatus != null) {
        this.SetStatus(this.mStatus == "open" ? "close": "open")
    }
    var b = (this.mContainer.GetSelected() == this.mID) ? this.mContainer.FireWorkflowOnSelectedItem() : true;
    if (this.mContainer.SelectItemOnClick()) {
        this.mContainer.SetSelected(this)
    }
    if (b) {
        var f = {
            f: ExecuteWorkflow,
            a: [this.mParentObj.windowID, 1, this.mID]
        };
        return {
            c: f
        }
    }
};
FlyoutItem.prototype.SetSelected = function() {};
FlyoutItem.prototype.MakeItemVisible = function() {};
FlyoutItem.prototype.setStyle = function(b) {
    if (b) {
        this.applyStyle()
    } else {
        this.removeStyle()
    }
};
FlyoutItem.prototype.getHorzDirection = function() {
    var h = true;
    var g = ComputeElementPosition(this.mObj, getFormElements_NS(this.mParentObj.windowID)["FormContainer"], 0, 0);
    var b = g.x;
    var f = getFormElements_NS(this.mParentObj.windowID)["FormContainer"].clientWidth;
    var d = b + this.mObj.offsetWidth + this.mObj.childNodes[1].offsetWidth;
    if (d > f) {
        h = false
    }
    return h
};
FlyoutItem.prototype.getVertDirection = function() {
    var d = ComputeElementPosition(this.mObj, getFormElements_NS(this.mParentObj.windowID)["FormContainer"], 0, 0);
    var k = d.y;
    var h = this.mObj.childNodes[1].firstChild;
    if (h == null) {
        return 0
    }
    this.mRowH = h.offsetHeight;
    if (h.parentNode.childNodes.length > 0) {
        this.mRowCnt = h.parentNode.childNodes.length / 2
    }
    if (this.mRowH == 0) {
        this.mRowH = 25
    }
    this.mH = this.mRowCnt * this.mRowH;
    var f = getFormElements_NS(this.mParentObj.windowID)["FormContainer"].scrollTop;
    var b = getFormElements_NS(this.mParentObj.windowID)["FormContainer"].clientHeight + f;
    var g = windowh = b - f;
    windowh = windowh - k;
    if (this.mH < windowh) {
        return 0
    }
    if (this.mH < k) {
        return 1
    }
    return - 1
};
function getLastSibling(f) {
    var d = 0;
    for (var b = 0; b < f.childNodes.length; b++) {
        if (f.childNodes[b].nodeType == 1) {
            d = b
        }
    }
    return d
}
FlyoutItem.prototype.applyStyle = function() {
    var h = " VNavHover" + (this.mLevel % 2);
    if (this.mObj.className.indexOf(h) == -1) {
        this.mObj.className = this.mObj.className + h
    }
    if ((this.mLevel > 0) && (this.mTextElement.className.indexOf(h) == -1)) {
        this.mTextElement.className = this.mTextElement.className + h
    }
    if (this.mLevel > 0) {
        if (this.mObj.previousSibling == null) {
            this.mObj.style.borderTop = "none"
        } else {
            this.mObj.style.borderTop = "1px solid #196697"
        }
        if (this.mObj.nextSibling.nextSibling == null) {
            this.mObj.style.borderBottom = "none"
        } else {
            this.mObj.style.borderBottom = "1px solid #196697"
        }
    } else {
        this.mObj.style.borderTop = "1px solid #196697";
        this.mObj.style.borderBottom = "1px solid #196697"
    }
    if (this.mObj.childNodes[1]) {
        var k = " menuhover" + (this.mLevel % 2);
        if (this.mLevel > 0 && this.mObj.className.indexOf(k) == -1) {
            this.mObj.className = this.mObj.className + " menuhover" + (this.mLevel % 2)
        }
        this.mObj.childNodes[1].style.display = "block";
        this.mObj.childNodes[1].style.visibility = "visible";
        this.mObj.childNodes[1].style.position = "absolute";
        var f = 0;
        var d = this.getVertDirection();
        if (d == 0) {
            this.mObj.childNodes[1].style.top = "-1px"
        } else {
            if (d == 1) {
                this.mObj.childNodes[1].style.bottom = "-1px";
                f = getLastSibling(this.mObj.childNodes[1])
            } else {
                var g = this.CreateExtensions();
                if (g == 0) {
                    this.mObj.childNodes[1].style.top = "-1px"
                } else {
                    if (g == 1) {
                        this.mObj.childNodes[1].style.bottom = "-1px";
                        f = getLastSibling(this.mObj.childNodes[1])
                    } else {
                        return
                    }
                }
            }
        }
        var b = "#eff3f5";
        if (this.mLevel % 2 == 0) {
            b = "#6ab8e9"
        }
        this.mObj.childNodes[1].childNodes[f].style.height = this.mObj.clientHeight;
        if (this.getHorzDirection()) {
            this.mObj.childNodes[1].style.left = "0";
            this.mObj.childNodes[1].style.marginLeft = "100%";
            this.mObj.childNodes[1].style.marginRight = "0";
            this.mObj.childNodes[1].childNodes[f].style.borderLeft = "1px solid " + b
        } else {
            this.mObj.childNodes[1].style.left = "auto";
            this.mObj.childNodes[1].style.right = "0";
            this.mObj.childNodes[1].style.marginLeft = "0";
            this.mObj.childNodes[1].style.marginRight = "100%";
            this.mObj.childNodes[1].childNodes[f].style.borderRight = "1px solid " + b
        }
        if (this.mStatus && this.mStatus != "open") {
            this.mStatus = "open"
        }
    }
};
FlyoutItem.prototype.removeStyle = function() {
    var b = " VNavHover" + (this.mLevel % 2);
    if (this.mObj.childNodes[1] && this.mLevel > 0) {
        this.mObj.className = this.mObj.className.replace(" menuhover" + (this.mLevel % 2), "")
    }
    this.mObj.className = this.mObj.className.replace(b, "");
    if (this.mLevel > 0) {
        this.mTextElement.className = this.mTextElement.className.replace(b, "");
        if (this.mObj.previousSibling) {
            this.mObj.style.borderTop = "none"
        }
        if (this.mObj.nextSibling) {
            this.mObj.style.borderBottom = "none"
        }
    } else {
        this.mObj.style.borderBottom = "1px solid #FFFFFF"
    }
};
FlyoutItem.prototype.DOMMouseOver = function(b) {
    if (b.element.nodeType == 1) {
        hoverState.eventMouseOver(b)
    }
    if (typeof this.mID == "number" && this.GetFocusElementForEvent() == null) {
        return
    }
    this.setStyle(true)
};
FlyoutItem.prototype.DOMMouseMove = function(b) {
    if (b.element.nodeType == 1) {
        hoverState.eventMouseMove(b)
    }
};
FlyoutItem.prototype.DOMMouseOut = function(b) {
    if (this.mParentObj.GAccess() == 3 || this.mObj.getAttribute("separator") == 1) {
        return
    }
    this.setStyle(false)
};
FlyoutItem.prototype.SetStatus = function(b) {
    if (this.mStatus != "open" && b == "open") {
        this.mStatus = "open";
        this.setStyle(true)
    } else {
        if (this.mStatus != "close" && b == "close") {
            this.mStatus = "close";
            this.setStyle(false);
            closeFlyout(this.mObj)
        }
    }
};
FlyoutItem.prototype.UpdateVis = function(b) {
    if (!this.mHaveVisualCharacteristics || (b && this.mObj.style.visibility == "inherit") || (!b && this.mObj.style.visibility == "hidden")) {
        return
    }
    if (this.mChildObj != null && this.mStatus == "open") {
        this.mChildObj.style.display = (b ? "block": "none");
        this.mChildObj.style.visibility = (b ? "inherit": "hidden")
    }
    this.mObj.style.display = (b ? "block": "none");
    this.mObj.style.visibility = (b ? "inherit": "hidden")
};
FlyoutItem.prototype.MouseSelectable = false;
FlyoutItem.prototype.UpdateAccess = function(d) {
    var b = " VNavDisabled";
    if (d == 3) {
        this.mObj.className += b;
        if (this.mStatus == "open") {
            this.SetStatus("close")
        }
    } else {
        this.mObj.className = this.mObj.className.replace(b, "")
    }
    this.mParentObj.mCFCache.a = d
};
FlyoutItem.prototype.GetFocusElement = function() {
    return this.mObj
};
FlyoutItem.prototype.GetFocusElementForEvent = function(b) {
    if (this.GetNestedFocusability()) {
        return this.mObj
    }
    return null
};
FlyoutItem.prototype.GetHoverValue = function(b) {
    return ""
};
FlyoutItem.prototype.TabableElementSelector = function(b) {
    return null
};
FlyoutItem.prototype.GetNestedFocusability = function() {
    return this.mParentObj.GetNestedFocusability()
};
FlyoutItem.prototype.GColour = function() {
    return this.getStyleFromChildOf(this.mObj, "color")
};
FlyoutItem.prototype.UpdateColour = function(b) {};
FlyoutItem.prototype.UpdateLabel = function(b) {};
FlyoutItem.prototype.UpdateFont = function(b) {};
DVertNavBar.prototype = new Field();
DVertNavBar.prototype.constructor = DVertNavBar;
DVertNavBar.superclass = Field.prototype;
DOMFieldFactories.VertNavBar = function(b, f, d) {
    return new DVertNavBar(b, f, d)
};
function DVertNavBar(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DVertNavBar.prototype.mDOMField = DVertNavBar.prototype.mHaveVisualCharacteristics = true;
DVertNavBar.prototype.init = function(g, f, d) {
    DVertNavBar.superclass.init.call(this, g, f, d);
    this.mSelected = this.mObj.getAttribute("initvalue");
    this.mNavMode = this.mObj.getAttribute("navmode");
    if (this.mNavMode == 1) {
        this.inFill = false;
        if (this.mObj.getAttribute("arcontainerid")) {
            this.inFill = true
        }
        if (this.mObj.getAttribute("arparentid")) {
            this.mContainerID = this.mObj.getAttribute("arparentid");
            if (this.inFill == false) {
                this._top = this.mObj.style.top;
                this._left = this.mObj.style.left
            }
        }
        var h = ComputeElementPosition(this.mObj, document.getElementById("FormContainer"), 0, 0);
        this.mObj.style.zIndex = 999999 - h.x;
        setHandlers(g, this.mObj)
    }
};
DVertNavBar.prototype.Reconstruct = function() {
    var f = this.mObj.childNodes[0];
    var q = f.firstChild;
    if (q == null) {
        return
    }
    var o = 0;
    var h = q.offsetHeight;
    if (q.parentNode.childNodes.length > 0) {
        o = q.parentNode.childNodes.length / 2
    }
    if (h == 0) {
        h = 25
    }
    var p = o * h;
    if (p > this.mObj.clientHeight) {
        var b = this.mObj.clientHeight - 2 - h;
        if (b < h) {
            b = h
        }
        b -= b % h;
        var d = Math.floor((b) / h);
        var k = new Array();
        createFlyout(f, d * 2, (o - d) * 2, f, k, true);
        for (var g = 0; g < k.length; g++) {
            f.removeChild(k[g])
        }
    }
};
function setHandlers(b, f) {
    var g = f.getElementsByTagName("DIV");
    for (var d = 0; d < g.length; d++) {
        if (g[d].className.indexOf("flyout") >= 0) {
            if (g[d].parentNode.className.indexOf("FlyoutContainer") >= 0) {
                if (!this.mContainerID) {
                    g[d].parentNode.onmouseover = function() {
                        moveFlyout(this, b)
                    };
                    g[d].parentNode.onmouseout = function() {
                        restoreFlyout(this, b)
                    }
                }
                continue
            }
            g[d].parentNode.onmouseover = function() {
                showFlyout(this)
            };
            g[d].parentNode.onmouseout = function() {
                closeFlyout(this)
            }
        }
    }
}
function moveFlyout(k, b) {
    var g = Field_FromElement(k);
    if (g) {
        clearTimeout(g.flyoutTimeout);
        if (typeof g.mContainerID != "undefined") {
            var h = g.mObj;
            if (h.parentNode.id != "FormContainer") {
                var d = ComputeElementPosition(h, getFormElements_NS(b)["FormContainer"], 0, 0);
                h.style.top = d.y;
                h.style.left = d.x;
                h.style.position = "absolute";
                getFormElements_NS(b)["FormContainer"].appendChild(h)
            }
        }
    }
}
function restoreFlyout(g, b) {
    var d = Field_FromElement(g);
    if (d) {
        var h = d;
        if (typeof h.mContainerID != "undefined") {
            d.flyoutTimeout = setTimeout(function() {
                if (h.mObj.parentNode.id == "FormContainer") {
                    if (h.inFill) {
                        h.mObj.style.top = "auto";
                        h.mObj.style.left = "auto";
                        h.mObj.style.position = "relative"
                    } else {
                        h.mObj.style.top = h._top;
                        h.mObj.style.left = h._left;
                        h.mObj.style.position = "absolute"
                    }
                    F(h.windowID, h.mContainerID).mPageBody.appendChild(h.mObj)
                }
            },
            3)
        }
    }
}
function showFlyout(k) {
    var d = Field_FromElement(k);
    if (k.className.indexOf("ext") == -1) {
        if (d) {
            if (typeof d.mID == "number" && d.GetFocusElementForEvent() == null) {
                return
            }
            d = d.mViewTypeObj;
            var b = " VNavHover" + (d.mLevel % 2);
            if (d.mObj.className.indexOf(b) == -1) {
                d.mObj.className = d.mObj.className + b
            }
            if ((d.mLevel > 0) && (d.mTextElement.className.indexOf(b) == -1)) {
                d.mTextElement.className = d.mTextElement.className + b
            }
            if (d.mLevel > 0) {
                if (d.mObj.previousSibling == null) {
                    d.mObj.style.borderTop = "none"
                } else {
                    d.mObj.style.borderTop = "1px solid #196697"
                }
                if (d.mObj.nextSibling.nextSibling == null) {
                    d.mObj.style.borderBottom = "none"
                } else {
                    d.mObj.style.borderBottom = "1px solid #196697"
                }
            } else {
                d.mObj.style.borderTop = "1px solid #196697";
                d.mObj.style.borderBottom = "1px solid #196697"
            }
            if (d.mObj.childNodes[1]) {
                var g = " menuhover" + (d.mLevel % 2);
                if (d.mLevel > 0 && d.mObj.className.indexOf(g) == -1) {
                    d.mObj.className = d.mObj.className + " menuhover" + (d.mLevel % 2)
                }
                d.mObj.childNodes[1].style.display = "block";
                d.mObj.childNodes[1].style.visibility = "visible"
            }
        }
    } else {
        var h = k.getElementsByTagName("div")[0];
        h.style.display = "block";
        h.style.visibility = "visible";
        h.style.position = "absolute";
        h.style.left = "1px";
        h.style.marginLeft = "100%";
        h.style.bottom = "-1px"
    }
}
function closeFlyout(g) {
    if (typeof g.className == "undefined") {
        return
    }
    if (g.className.indexOf("ext") == -1) {
        var b = Field_FromElement(g);
        if (b) {
            b.setStyle(false);
            if (b.mStatus && b.mStatus != "close") {
                b.mStatus = "close"
            }
        }
    }
    var d = g.getElementsByTagName("div")[0];
    if (d) {
        d.style.display = "none";
        d.style.visibility = "hidden"
    }
}
DVertNavBar.prototype.Clear = function() {};
DVertNavBar.prototype.DOMClick = function(b) {
    if (this.GAccess() == 3) {
        return
    }
    var d = {
        f: ExecuteWorkflow,
        a: [this.windowID, 1, this.mID]
    };
    return {
        c: d
    }
};
DVertNavBar.prototype.MouseSelectable = false;
DVertNavBar.prototype.GetFocusElement = function() {
    return this.mObj
};
DVertNavBar.prototype.GetFocusElementForEvent = function(b) {
    if (this.GetNestedFocusability()) {
        return this.mObj
    }
    return null
};
DVertNavBar.prototype.FireWorkflowOnSelectedItem = function() {
    if (this.mObj.getAttribute("workflowonselected") == 1) {
        return true
    }
    return false
};
DVertNavBar.prototype.SelectItemOnClick = function() {
    if (this.mObj.getAttribute("selectonclick") == 1) {
        return true
    }
    return false
};
DVertNavBar.prototype.GetSelected = function() {
    return this.mSelected
};
DVertNavBar.prototype.SetSelected = function(b) {
    if (b.mID == this.mSelected) {
        return
    }
    if (this.mSelected) {
        var d = F(this.windowID, this.mSelected).mObj;
        if ("className" in d) {
            d.className = d.className.replace("VNavLeaf VNavSelected", "VNavLeaf")
        }
    }
    b.mObj.className = b.mObj.className.replace("VNavLeaf", "VNavLeaf VNavSelected");
    this.mSelected = b.mID
};
DVertNavBar.prototype.ResizeTo = function(f, b) {
    if (f < this.mMinWidth) {
        this.mObj.style.width = this.mMinWidth
    } else {
        if (f > this.mMaxWidth) {
            this.mObj.style.width = this.mMaxWidth
        } else {
            this.mObj.style.width = Math.round(f * (this.perWidth / 100))
        }
    }
    if (this.mObj.style.height == "auto") {
        return
    }
    var d = Math.round(b * (this.perHeight / 100));
    if (d < this.mMinHeight) {
        this.mObj.style.height = this.mMinHeight
    } else {
        if (d > this.mMaxHeight) {
            this.mObj.style.height = this.mMaxHeight
        } else {
            this.mObj.style.height = Math.round(b * (this.perHeight / 100))
        }
    }
    var g = F(this.windowID, this.mContainerID);
    if (g instanceof DPage && g.mFillModel && g.mState == 1 && g.mFit) {
        g.getChildScroll(this)
    }
};
DVertNavBar.prototype.mHaveStoredData = false;
DVertNavBar.prototype.mContainFields = true;
DVertNavBar.prototype.TabableElementSelector = function(b) {
    return null
};
DVertNavBar.prototype.getScrollheight = function() {
    var b = 0;
    var d = this.mObj;
    if (d.scrollHeight > d.offsetHeight) {
        b = d.scrollHeight - d.offsetHeight
    }
    return b
};
DVertNavBar.prototype.getScrollwidth = function() {
    var b = 0;
    var d = this.mObj;
    if (d.scrollWidth > d.offsetWidth) {
        b = d.scrollWidth - d.offsetWidth
    }
    return b
};
DHorzNavBar.prototype = new Field();
DHorzNavBar.prototype.constructor = DHorzNavBar;
DHorzNavBar.superclass = Field.prototype;
DOMFieldFactories.HorzNavBar = function(b, f, d) {
    return new DHorzNavBar(b, f, d)
};
function DHorzNavBar(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DHorzNavBar.prototype.mDOMField = DHorzNavBar.prototype.mHaveVisualCharacteristics = true;
DHorzNavBar.prototype.init = function(g, f, d) {
    DHorzNavBar.superclass.init.call(this, g, f, d);
    this.mSelected = this.mObj.getAttribute("initvalue")
};
DHorzNavBar.prototype.Clear = function() {};
DHorzNavBar.prototype.DOMClick = function(b) {
    if (this.GAccess() == 3) {
        return
    }
    var d = {
        f: ExecuteWorkflow,
        a: [this.windowID, 1, this.mID]
    };
    return {
        c: d
    }
};
DHorzNavBar.prototype.MouseSelectable = false;
DHorzNavBar.prototype.GetFocusElement = function() {
    return this.mObj
};
DHorzNavBar.prototype.GetFocusElementForEvent = function(b) {
    if (this.GetNestedFocusability()) {
        return this.mObj
    }
    return null
};
DHorzNavBar.prototype.FireWorkflowOnSelectedItem = function() {
    if (this.mObj.getAttribute("workflowonselected") == 1) {
        return true
    } else {
        return false
    }
};
DHorzNavBar.prototype.SelectItemOnClick = function() {
    if (this.mObj.getAttribute("selectonclick") == 1) {
        return true
    } else {
        return false
    }
};
DHorzNavBar.prototype.GetSelected = function() {
    return this.mSelected
};
DHorzNavBar.prototype.SetSelected = function(b) {
    if (b.mID == this.mSelected) {
        return
    }
    if (this.mSelected) {
        var d = F(this.windowID, this.mSelected).mObj;
        d.className = d.className.replace("HNavSelected", "HNavItem")
    }
    b.mObj.className = b.mObj.className.replace("HNavItem", "HNavSelected");
    this.mSelected = b.mID
};
DHorzNavBar.prototype.ResizeTo = function(d, b) {
    if (this.mObj.style.width != this.perWidth + "%") {
        this.mObj.style.width = this.perWidth + "%"
    }
};
DHorzNavBar.prototype.mHaveStoredData = false;
DHorzNavBar.prototype.mContainFields = true;
DHorzNavBar.prototype.TabableElementSelector = function(b) {
    return null
};
DChar.prototype = new DataField();
DChar.prototype.constructor = DChar;
DChar.superclass = DataField.prototype;
JChar.prototype = new Field();
JChar.prototype.constructor = JChar;
JChar.superclass = Field.prototype;
TPAChar.prototype = new Field();
TPAChar.prototype.constructor = TPAChar;
TPAChar.superclass = Field.prototype;
DOMFieldFactories.Char = function(b, f, d) {
    return new DChar(b, f, d)
};
function DChar(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DChar.prototype.init = function(g, b, f) {
    this.mInputNode = f.childNodes[2];
    this.mRTF = (this.mInputNode.className.indexOf("rtf") != -1);
    this.mRTFAttachmentFieldID = -1;
    var p = this.mInputNode.getAttribute("arpool");
    if (p != null) {
        this.mRTFAttachmentFieldID = parseInt(p)
    }
    this.mRTFJoinIndex = -1;
    var h = this.mInputNode.getAttribute("arindx");
    if (h != null) {
        this.mRTFJoinIndex = parseInt(h)
    }
    this.mRTFAdvanced = this.mRTF && ((this.mInputNode.getAttribute("artf") != null) ? true: false);
    this.mbShowURL = (this.mInputNode.getAttribute("arshowurl") != null) ? true: false;
    if (this.mRTF) {
        var q = this;
        this.mInputNode.focus = function() {
            if (q.GAccess() != 1) {
                q.ShowRTF(q.mInputNode)
            }
        };
        this.mInputNode.dir = "ltr"
    }
    this.mOrgValue = "";
    this.mMaxLen = this.mInputNode.getAttribute("maxlen");
    this.mAutoCompleteCreated = false;
    DChar.superclass.init.call(this, g, b, f);
    if (this.mInputNode.getAttribute("armenu") && this.mInputNode.getAttribute("armenu").length > 0) {
        this.mbShowURL = null
    }
    if (this.mbShowURL) {
        var f = this.mObj;
        f = f.firstChild;
        while (1) {
            if (f.nodeType == 1 && f.tagName == "DIV" && f.className.indexOf("text") != -1) {
                break
            }
            if (!f.nextSibling) {
                break
            }
            f = f.nextSibling
        }
        this.mDivEditBox = f;
        this.mDivEditBox.dir = "ltr";
        this.mInputNode.onblur = DChar.convert
    }
    if (this.mRTF) {
        var k = YAHOO.util.Dom;
        var o = this.mInputNode.className.indexOf(" sr ") >= 0;
        var d = this.mInputNode.getAttribute("arautosize");
        if (d == null || typeof d == "undefined") {
            d = "0"
        }
        this.mAutoSizeHeight = !o && (d == "1" || d == "3");
        this.mAutoSizeWidth = !o && (d == "2" || d == "3");
        var d = this.mInputNode.getAttribute("maxwidth");
        if (d == null || typeof d == "undefined") {
            this.mMaxWidth = 0
        } else {
            this.mMaxWidth = parseInt(d)
        }
        var d = this.mInputNode.getAttribute("armaxheight");
        if (d == null || typeof d == "undefined") {
            this.mMaxHeight = 0
        } else {
            this.mMaxHeight = parseInt(d)
        }
        this.mMinWidth = parseInt(k.getStyle(this.mInputNode, "width"), 10);
        this.mMinHeight = parseInt(k.getStyle(this.mInputNode, "height"), 10);
        this.InitInputNode()
    }
};
DChar.convert = FormEvent.Trampoline(function(b) {
    var g = Field_FromElement(b.element);
    var d = g.GetValue();
    if (g.mOrgValue != d) {
        g.SetValue(d);
        g.FieldValChanged();
        g.mOrgValue = d
    }
});
TPAChar.prototype.ConvertPrimitiveToDataType = JChar.prototype.ConvertPrimitiveToDataType = DChar.prototype.ConvertPrimitiveToDataType = function(b) {
    return new CharType(b)
};
DChar.prototype.FromUIInput = function(f, d, b) {
    if (b) {
        f = ExpandString(this.windowID, f, 2 | 4, this.mID, 10)
    }
    f = f.trim(1 | 2);
    if (f == "") {
        return Null
    }
    return new CharType(f)
};
DChar.prototype.ConvertDTForS = DChar.prototype.ConvertDTForSLE = function(b) {
    if (b.type == 4) {
        return b
    }
    return new CharType(b.toString())
};
DChar.prototype.UpdateMenu = function(d) {
    if (d == null) {
        return
    }
    var b = this.GMenu();
    if ((b && b == "$NULL$") || d == "$NULL$") {
        var f = this.mObj.firstChild;
        while (true) {
            if (f.firstChild) {
                f = f.firstChild
            } else {
                while (!f.nextSibling) {
                    f = f.parentNode;
                    if (f == this.mObj) {
                        return
                    }
                }
                f = f.nextSibling
            }
            if (f.className && f.className.indexOf("menu") != -1) {
                f.style.visibility = ((d == "$NULL$") ? "hidden": "inherit");
                break
            }
        }
    }
};
JChar.prototype.UpdateAccess = function(b) {
    if (this instanceof DChar) {
        DChar.superclass.UpdateAccess.call(this, b)
    }
    if (this.isDropDown()) {
        if (this.mInputNode) {
            this.mInputNode.readOnly = true
        }
    }
    if (this.mInputNode) {
        this.mInputNode.actb_autoCompleteEnabled = (b == 2)
    }
};
TPAChar.prototype.isDropDown = JChar.prototype.isDropDown = DChar.prototype.isDropDown = function() {
    if (!this.mInputNode) {
        return false
    }
    return this.mInputNode.getAttribute("mdd") == "1"
};
TPAChar.prototype.isRTF = JChar.prototype.isRTF = DChar.prototype.isRTF = function() {
    return this.mRTF
};
TPAChar.prototype.isRTFAdvanced = JChar.prototype.isRTFAdvanced = DChar.prototype.isRTFAdvanced = function() {
    return this.mRTFAdvanced
};
TPAChar.prototype.getRTFAttachmentFieldID = JChar.prototype.getRTFAttachmentFieldID = DChar.prototype.getRTFAttachmentFieldID = function() {
    return this.mRTFAttachmentFieldID
};
DChar.prototype.GTrim = JChar.prototype.GTrim = TPAChar.prototype.GTrim = function() {
    var d = this.G();
    if (d == CharNull || d.isNull) {
        return d
    }
    var b = d.toPrimitive();
    if (b == "") {
        return CharNull
    }
    b = b.trim(1 | 2);
    if (b == "") {
        return CharNull
    }
    return this.ConvertPrimitiveToDataType(b)
};
TPAChar.prototype.checkMenuChanged = function() {
    var g = this.GMenu();
    if (g != null) {
        var f = getFields_NS(this.windowID)[this.mColid];
        if (f != null) {
            if (f.mObj.lcl) {
                var d = getFields_NS(this.windowID)[f.mObj.fid];
                if (d != null) {
                    var b = d.mCFCache.m;
                    if (b != g) {
                        f.mCFCache.m = b;
                        this.SMenu(b)
                    }
                }
            }
        }
    }
};
TPAChar.prototype.verifyAddClear = JChar.prototype.verifyAddClear = DChar.prototype.verifyAddClear = function(b) {
    if (this instanceof TPAChar) {
        this.checkMenuChanged()
    }
    if (this.isSearchOnly()) {
        if (getARStateCurrent_NS(this.windowID) == 4) {
            return {
                n: {
                    f: ARMenu_Open,
                    a: [this, this.GMenu(), b, this.isSearchOnly()]
                }
            }
        } else {
            return {
                n: {
                    f: ARMenu_Open,
                    a: [this, this.GMenu(), b, false]
                }
            }
        }
    } else {
        return {
            n: {
                f: ARMenu_Open,
                a: [this, this.GMenu(), b, this.isDropDown()]
            }
        }
    }
};
TPAChar.prototype.isSearchOnly = JChar.prototype.isSearchOnly = DChar.prototype.isSearchOnly = function() {
    if (this.mInputNode.getAttribute("searchOnly") == "1") {
        return true
    } else {
        return false
    }
};
DChar.prototype.mDataType = 4;
DChar.prototype.mMaxLen = 0;
JFieldFactories.Char = function(b, f, d) {
    return new JChar(b, f, d)
};
function JChar(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAFieldFactories.Char = function(b, f, d) {
    return new TPAChar(b, f, d)
};
function TPAChar(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAChar.prototype.G = JChar.prototype.G = function() {
    var b = this.mObj.v;
    if (b.isNull || b.toString() == "") {
        return CharNull
    } else {
        if (b.type == 4) {
            return b
        } else {
            this.mObj.v = new CharType(b);
            return this.mObj.v
        }
    }
};
TPAChar.prototype.DoSet = TPAChar.prototype.DoSLoadEntry = JChar.prototype.DoSet = JChar.prototype.DoSLoadEntry = function(d) {
    var f = {
        hasKeyword: false,
        hasTemporalKeyword: false
    };
    var b = ExpandString(this.windowID, d.toString(), 2 | 4 | 8, this.mID, this.mDataType, f);
    if (f.hasTemporalKeyword) {
        this.mObj.v = (d.isNull) ? CharNull: d
    } else {
        if ((this.mDataType == 4) && !f.hasKeyword) {
            this.mObj.v = (d.isNull) ? CharNull: d
        } else {
            this.mObj.v = new CharType(b)
        }
    }
    if (this instanceof JChar) {
        this.SetDirty()
    }
};
TPAChar.prototype.mHaveStoredData = DChar.prototype.mHaveStoredData = JChar.prototype.mHaveStoredData = true;
TPAChar.prototype.SetScreenValue = JChar.prototype.SetScreenValue = function(b) {
    do {
        if (! (this.mInputNode)) {
            Assert("(Char.js:275) this.mInputNode")
        }
    } while ( 0 );
    if (this.isRTF()) {
        this.SetRTFVal(b)
    } else {
        this.mInputNode.value = b
    }
    this.FieldValChanged()
};
TPAChar.prototype.FieldValChanged = function(b) {
    var d = this.GetScreenValAsPrimitive(b);
    if (typeof d == "undefined" || this.mPrimVal == d) {
        return
    }
    this.mPrimVal = d;
    if (d == "") {
        this.mDataVal = (this.mDataType == 4) ? CharNull: Null
    } else {
        var f = {
            hasKeyword: false,
            hasTemporalKeyword: false
        };
        d = ExpandString(this.windowID, d, 2 | 4, this.mID, this.mDataType, f);
        if (f.hasTemporalKeyword) {
            this.mDataVal = null
        } else {
            if (d == "") {
                if (f.hasKeyword) {
                    this.mDataVal = (this.mDataType == 4) ? CharNullType.KEYWORD_CHAR_NULL: NullType.KEYWORD_NULL
                } else {
                    this.mDataVal = (this.mDataType == 4) ? CharNull: Null
                }
            } else {
                this.mDataVal = this.ConvertPrimitiveToDataType(d)
            }
        }
    }
    this.DoSet(this.mDataVal)
};
TPAChar.prototype.GetScreenValAsPrimitive = function(d) {
    if (d != null) {
        return d.element.value
    }
    if (this.mInputNode == null) {
        if (d == null) {
            return ""
        } else {
            var b = d.element.parentNode;
            this.mInputNode = b.childNodes[2];
            if (this.mInputNode == null) {
                return ""
            }
            this.mMaxLen = this.mInputNode.getAttribute("maxlen")
        }
    }
    if (this.isRTF()) {
        return this.GetRTFVal()
    } else {
        return this.mInputNode.value
    }
};
TPAChar.prototype.SetDirty = function() {
    return
};
TPAChar.prototype.UpdateAccess = DChar.prototype.UpdateAccess = function(f) {
    if (this instanceof DChar) {
        if (this.mbShowURL || this.mRTF) {
            var d = f == 3,
            b = f == 1;
            var g = this.mObj;
            g.className = g.className.replace(SACCESSRE, "");
            if (d) {
                g.className += " dfd"
            }
            if (this.mbShowURL) {
                this.mDivEditBox.style.backgroundColor = (b ? getARFieldROBg_NS(this.windowID) : "")
            }
            this.mInputNode.disabled = d;
            this.mInputNode.readOnly = b;
            this.mInputNode.style.backgroundColor = (b ? getARFieldROBg_NS(this.windowID) : "")
        } else {
            DChar.superclass.UpdateAccess.call(this, f)
        }
    }
    if (this.isDropDown()) {
        if (this.mInputNode) {
            this.mInputNode.readOnly = true
        }
    }
    if (this.mInputNode) {
        this.mInputNode.actb_autoCompleteEnabled = (f == 2)
    }
    if (this.mRTF) {
        if (this.mInputNode) {
            this.mInputNode.readOnly = true
        }
    }
};
TPAChar.prototype.DOMKeyPress = DChar.prototype.DOMKeyPress = function(d) {
    if (this instanceof TPAChar) {
        var b = d.element.parentNode;
        this.mInputNode = b.childNodes[2];
        this.mMaxLen = this.mInputNode.getAttribute("maxlen")
    }
    if (d.key == 13) {
        var g = this.mInputNode;
        var h = false;
        if ("actb_autoCompleted" in g) {
            if (g.actb_autoCompleted) {
                h = true;
                g.actb_autoCompleted = false
            }
        }
        var f = false;
        if ("actb_selected" in g) {
            if (g.actb_selected) {
                f = true;
                g.actb_selected = false
            }
        }
        if (!f && !h && (d.shift || (g.getAttribute("wrap") == "off") || g.tagName == "INPUT")) {
            d.StopDefault();
            return {
                c: {
                    t: this,
                    f: DChar.superclass.DOMKeyPress,
                    a: [d]
                }
            }
        } else {
            g.actb_selected = false
        }
    } else {
        checkLength(d, this.windowID, this.mInputNode, this.mMaxLen)
    }
};
TPAChar.prototype.DOMKeyDown = DChar.prototype.DOMKeyDown = function(d) {
    if (this.GAccess() == 3) {
        return
    }
    if (this instanceof TPAChar) {
        var b = d.element.parentNode;
        this.mInputNode = b.childNodes[2];
        this.mMaxLen = this.mInputNode.getAttribute("maxlen")
    }
    if (d.key == 40 && d.alt) {
        var f = d.element;
        if (f) {
            if (this.GMenu()) {
                if (this.GAccess() != 1) {
                    return {
                        c: {
                            f: ExecuteWorkflow,
                            a: [this.windowID, 64, this.mID]
                        },
                        n: {
                            a: [f],
                            t: this,
                            f: function(h) {
                                var g;
                                g = this.isDropDown() ? this.mInputNode: h;
                                this.verifyAddClear(g)
                            }
                        }
                    }
                }
            }
        }
    } else {
        if (d.key != 13 && d.key != 16) {
            checkLength(d, this.windowID, this.mInputNode, this.mMaxLen)
        }
    }
};
function appendMenuLeafPathElements(p, k, o, g) {
    var h;
    for (h = 0; h < p.length; ++h) {
        if (p[h].v && p[h].v instanceof Array && p[h].v.length > 0) {
            var f = p[h].l;
            if (k != null && k.length > 0) {
                f = k + "/" + f
            }
            appendMenuLeafPathElements(p[h].v, f, o, g)
        } else {
            var d = (p[h].v) ? p[h].v: p[h].l;
            d = d.HTMLDecode().ValidatorUnEscape();
            var q;
            if (g) {
                q = p[h].l
            } else {
                q = d
            }
            o.acValues.push(d);
            o.acLabelLengths.push(q.length);
            var b = q;
            if (k != null && k.length > 0) {
                b += " <i>(" + k + ")</i>"
            }
            o.acLabels.push(b.HTMLDecode().ValidatorUnEscape())
        }
    }
}
function listOfMenuLeafValuesForField(q, g, b) {
    if (!q.GMenu()) {
        return null
    }
    if (!q.mInputNode) {
        return null
    }
    var h = null;
    var p = new Object();
    p.acLabelLengths = new Array();
    p.acLabels = new Array();
    p.acValues = new Array();
    try {
        var k = q.GMenu();
        var d = ARMenu.getMenu(q.windowID, k);
        if (d == null) {
            new NDXGetMenuDefinition(q.windowID, k, ARKWGetStringByIdx(q.windowID, 7));
            d = ARMenu.getMenu(q.windowID, k);
            d.cfid = q.mID;
            d.addField(q.mID)
        }
        if (d == null) {
            handleMenuAbsent(k);
            return null
        }
        q.menu = d;
        d.cfid = q.mID;
        if (!d.FieldMap[q.mID]) {
            d.addField(q.mID);
            d.setAttribute(d.cfid, "acField", q);
            d.setAttribute(d.cfid, "arautocak", parseInt(q.mInputNode.getAttribute("arautocak")));
            d.setAttribute(d.cfid, "arautoctt", parseInt(q.mInputNode.getAttribute("arautoctt")));
            var f = q.mInputNode.getAttribute("arautocmb");
            if (f) {
                if (d.mMenuData.l == 1) {
                    d.setAttribute(d.cfid, "arautocnc", "err")
                }
            } else {
                if (d.mMenuData.v == 1) {
                    d.setAttribute(d.cfid, "arautocnc", "err")
                }
            }
        } else {
            d.setAttribute(d.cfid, "acField", q)
        }
        h = ARMenu_Get(q.windowID, q.GMenu(), null, b)
    } catch(o) {
        return p
    }
    if (!h) {
        return null
    }
    if (!h.mMenuDef) {
        return null
    }
    appendMenuLeafPathElements(h.mMenuDef, "", p, g);
    return p
}
TPAChar.prototype.DOMFocus = DChar.prototype.DOMFocus = function(q) {
    if (this instanceof TPAChar) {
        var k = q.element.parentNode;
        this.mInputNode = k.childNodes[2];
        this.mMaxLen = this.mInputNode.getAttribute("maxlen")
    }
    if (this.mInputNode != null) {
        var b = this.mInputNode.getAttribute("arautoc");
        this.mInputNode.hasFocus = true;
        var g = (b != null) && (b == "1" || b == "2");
        var f = this.mInputNode.getAttribute("arautocmb");
        var p = (f != null) && (f == "1");
        if (g) {
            this.mInputNode.actb_autoCompleteEnabled = (this.GAccess() == 2);
            var h = listOfMenuLeafValuesForField(this, p, "");
            if (this.menu) {
                if (this.menu.mCharFieldMenu || (!this.mAutoCompleteCreated) || (this instanceof TPAChar)) {
                    actb(this);
                    this.mAutoCompleteCreated = true;
                    this.mInputNode.actb_selected = false;
                    if (this.menu.getAttribute(this.menu.cfid, "requestLoad")) {
                        this.menu.setState(3)
                    }
                } else {
                    this.menu.reInit()
                }
                if (this.mAutoCompleteCreated) {
                    this.mInputNode.actb_autoCompleted = false;
                    if (h != null) {
                        actb_values = (h.acValues != null) ? h.acValues: new Array();
                        actb_keywords = (h.acLabels != null) ? h.acLabels: h.acValues;
                        actb_lengths = (h.acLabelLengths != null) ? h.acLabelLengths: new Array();
                        this.menu.setAttribute(this.menu.cfid, "ac_kw_len", actb_keywords.length);
                        if (ARMenu.getMenu(this.windowID, this.menu.mMenuName).getAttribute(this.menu.cfid, "tItems") == -1) {
                            this.menu.setAttribute(this.menu.cfid, "tItems", actb_lengths.length);
                            this.menu.setAttribute(this.menu.cfid, "ac_kw_len", -1)
                        }
                    }
                    actb_firstText = (b == "1");
                    var o = this;
                    actb_completionListener = function(s) {
                        o.mDataVal.mValue = s.value;
                        promptBar.setToClear();
                        new WorkflowContext(o.windowID, {
                            f: ExecuteWorkflow,
                            a: [o.windowID, 128, o.mID]
                        })
                    }
                }
            } else {
                handleMenuAbsent(" of field " + this.mInputNode.id)
            }
        } else {
            actb_keywords = [];
            actb_values = [];
            actb_lengths = [];
            var d = getARMenuCache_NS(this.windowID)[this.GMenu()];
            if (d) {
                d.cfid = this.mID;
                if (!d.FieldMap[this.mID]) {
                    d.addField(this.mID)
                }
            }
        }
    }
    if (this instanceof TPAChar) {
        this.mDOMField = true
    }
    return DChar.superclass.DOMFocus.call(this, q)
};
DChar.prototype.DOMBlur = function(b) {
    delete getARMaps_NS(this.windowID)[this.mID];
    delete getARArrays_NS(this.windowID)[this.mID];
    if (this.isRTF()) {
        if (this.mRTFAttachmentFieldID > 0 && this.mRTFAttachmentFieldID in getFields_NS(this.windowID)) {
            var f = getFields_NS(this.windowID)[this.mRTFAttachmentFieldID];
            var d = this;
            setTimeout(function() {
                var k = d.GetIFrameDoc();
                GlobalVerifyAttachments(d.windowID, k, f);
                f = null;
                d = null
            },
            10)
        }
        RTF_Close(true)
    }
    if (this.mInputNode != null) {
        var h = this.mInputNode.getAttribute("arautoc");
        this.mInputNode.hasFocus = false;
        var g = (h != null) && (h == "1" || h == "2");
        if (g && this.menu) {
            this.acdirtyfocus = true;
            if (this.menu.FieldMap[this.mID]) {
                setTimeout("this.removeACFieldReference", 100);
                this.menu.setAttribute(this.menu.cfid, "ac_kw_len", -1)
            }
        }
    }
    return DChar.superclass.DOMBlur.call(this, b)
};
DChar.prototype.removeACFieldReference = function() {
    this.menu.setAttribute(this.mID, "acField", null)
};
function GlobalVerifyAttachments(d, s, v) {
    try {
        if (v != null && s != null) {
            var h = [];
            var u = s.getElementsByTagName("img");
            for (var g = 0; g < u.length; g++) {
                var f = u[g];
                if (f) {
                    var k = f.getAttribute("arattid");
                    if (k != null && k.length > 0) {
                        var w = parseInt(k);
                        h[w] = true
                    }
                }
            }
            var q = v.GetUsedRowIds();
            if (q && q.length > 0) {
                for (var g = 0; g < q.length; g++) {
                    var p = q[g];
                    if (h == null || h.length == 0 || !(p in h)) {
                        if (p in getFields_NS(d)) {
                            var b = getFields_NS(d)[p];
                            new WorkflowContext(d, {
                                f: function() {
                                    var y = {};
                                    return b.Delete(y)
                                },
                                t: self
                            })
                        }
                    }
                }
            }
        }
    } catch(o) {}
}
TPAChar.prototype.DOMClick = DChar.prototype.DOMClick = function(d) {
    DChar.superclass.DOMClick.call(this, d);
    if (this.GAccess() == 3) {
        return
    }
    var f = FakeButton_Find(d.element);
    if (f) {
        this.HideRTF(true);
        if (this instanceof TPAChar) {
            var b = f.parentNode;
            this.mInputNode = b.childNodes[2];
            this.mMaxLen = this.mInputNode.getAttribute("maxlen")
        }
        if (f.className.indexOf("menu") != -1 && this.GMenu() != null) {
            if (this.GAccess() != 1) {
                return {
                    c: {
                        f: ExecuteWorkflow,
                        a: [this.windowID, 64, this.mID]
                    },
                    n: {
                        a: [f],
                        t: this,
                        f: function(k) {
                            var h;
                            h = this.isDropDown() ? this.mInputNode: k;
                            return {
                                n: {
                                    f: this.verifyAddClear,
                                    t: this,
                                    a: [h]
                                }
                            }
                        }
                    }
                }
            }
        } else {
            if (f.className.indexOf("richtext") != -1) {
                if (currentRTFPopup && currentRTFPopup.IsVisible()) {
                    currentRTFPopup.OnOK()
                }
                var g = this.mInputNode.getAttribute("id");
                if (!this.mRichTextEditBox) {
                    this.mRichTextEditBox = GetRTFPopup(this);
                    if (this instanceof TPAChar) {
                        this.mRichTextEditBox.ShowPopup(f, 3, f.offsetHeight + 3, false)
                    } else {
                        this.mRichTextEditBox.ShowPopup(f, 0, f.offsetHeight, false)
                    }
                } else {
                    this.mRichTextEditBox.SetFocus()
                }
            } else {
                if (f.className.indexOf("expand") != -1 || f.className.indexOf("edit") != -1) {
                    if (!this.mCharEditBox) {
                        this.mCharEditBox = new CharEditPopup(this);
                        this.mCharEditBox.SetOrigin();
                        this.mCharEditBox.SetContents();
                        if (this instanceof TPAChar) {
                            this.mCharEditBox.ShowPopup(f, 3, f.offsetHeight + 3, true)
                        } else {
                            this.mCharEditBox.ShowPopup(f, 0, f.offsetHeight, true)
                        }
                    } else {
                        this.mCharEditBox.SetFocus()
                    }
                } else {
                    if (f.className.indexOf("fileupload") != -1) {
                        if (this.GAccess() == 1) {
                            return
                        }
                        if (!this.mFileEditBox) {
                            this.mFileEditBox = new FileEditPopup(this);
                            this.mFileEditBox.SetOrigin();
                            this.mFileEditBox.SetContents();
                            if (this instanceof TPAChar) {
                                this.mFileEditBox.ShowPopup(f, 3, f.offsetHeight + 3, true)
                            } else {
                                this.mFileEditBox.ShowPopup(f, 0, f.offsetHeight, true)
                            }
                        } else {
                            this.mFileEditBox.SetFocus()
                        }
                    }
                }
            }
        }
    } else {
        if (this.isDropDown() && this.GAccess() != 1) {
            if (getARStateCurrent_NS(this.windowID) == 4) {
                this.mInputNode.readOnly = false
            } else {
                this.mInputNode.readOnly = true;
                return {
                    c: {
                        f: ExecuteWorkflow,
                        a: [this.windowID, 64, this.mID]
                    },
                    n: {
                        t: this,
                        f: function() {
                            if (this.isSearchOnly()) {
                                if (getARStateCurrent_NS(this.windowID) == 4) {
                                    ARMenu_Open(this, this.GMenu(), this.mInputNode, this.isSearchOnly())
                                } else {
                                    ARMenu_Open(this, this.GMenu(), this.mInputNode, false)
                                }
                            } else {
                                ARMenu_Open(this, this.GMenu(), this.mInputNode, this.isDropDown())
                            }
                        }
                    }
                }
            }
        } else {
            if (this.isRTF() && this.GAccess() != 1 && this.mInputNode != null) {
                if (currentRTFPopup != null && currentRTFPopup.IsVisible()) {
                    currentRTFPopup.OnOK()
                }
                this.ShowRTF(this.mInputNode)
            }
        }
    }
};
TPAChar.prototype.InsertAtCaret = DChar.prototype.InsertAtCaret = function(b, g) {
    if (this.isRTF()) {
        var d = b.innerHTML;
        if (d != null && d != "") {
            g = " " + g
        }
        var f = this.GetIFrameDoc();
        if (f) {
            var h = f.body.innerHTML;
            f.body.innerHTML = h + g
        }
    } else {
        DChar.superclass.InsertAtCaret.call(this, b, g)
    }
};
TPAChar.prototype.HandleMenuSelection = DChar.prototype.HandleMenuSelection = function(k) {
    var f = this.mInputNode;
    var h = f.getAttribute("mstyle");
    var g = this.isRTF() ? f.innerHTML: f.value;
    if (h == 2) {
        this.isRTF() ? this.SetRTFVal(k) : f.value = k
    } else {
        if (g != null && g != "") {
            k = " " + k
        }
        if (f.className.indexOf("dat") != -1) {
            var d = g + k;
            this.isRTF() ? f.innerHTML = d: f.value = d
        } else {
            this.InsertAtCaret(f, k)
        }
    }
    if (this instanceof DChar) {
        if (g != k) {
            delete getARMaps_NS(this.windowID)[this.mID];
            delete getARArrays_NS(this.windowID)[this.mID];
            this.FieldValChanged();
            this.SetDirty(f)
        }
    } else {
        if (g != k) {
            var b = new FormEvent(this.windowID, this.mParentid);
            b.element = f;
            getFields_NS(this.windowID)[this.mParentid].FieldValChanged(b, k);
            this.SetDirty(f)
        }
    }
};
function checkLength(p, f, o, g) {
    if (getARStateCurrent_NS(f) == 4) {
        return
    }
    if (!p.alt && !p.ctrl && p.key != 46 && p.key != 8 && p.key != 36 && p.key != 35 && p.key != 39 && p.key != 37 && p.key != 45 && g != 0) {
        var k = false;
        if (document.selection) {
            var d = document.selection.createRange().duplicate();
            k = d.text.length > 0
        } else {
            if ("selectionStart" in o) {
                var b = o.selectionStart,
                h = o.selectionEnd;
                k = (b != h)
            }
        }
        var q = null;
        if (o && o.className.indexOf("DivEditor") >= 0) {
            q = getInnerText(o)
        } else {
            if (this.isRTF && this.isRTF()) {
                q = o.innerHTML
            } else {
                q = o.value
            }
        }
        if (!k && q && q.length >= g) {
            p.StopDefault();
            return
        }
    }
}
DChar.prototype.TabableElementSelector = function(b) {
    if ((b.tagName == "A" && b.className && b.className.indexOf("btn") >= 0) || b.tagName == "INPUT" || b.tagName == "TEXTAREA" || (b.tagName == "DIV" && b.className.indexOf("text") >= 0)) {
        if (!b.style || b.style.visibility != "hidden") {
            return b
        }
    }
    return null
};
DChar.prototype.innerText = function() {
    return getInnerText(this.mDivEditBox)
};
DChar.prototype.updateInnerHTML = function(g) {
    var f = this.mDivEditBox;
    f.innerHTML = g;
    var b = f.getElementsByTagName("a");
    for (var d = 0; d < b.length; d++) {
        if (f.contentEditable == "true") {
            b[d].onmouseover = function() {
                f.contentEditable = false
            };
            b[d].onmouseout = function() {
                f.contentEditable = true
            }
        }
        b[d].target = "_blank";
        b[d].href = b[d].innerHTML
    }
    this.FieldValChanged()
};
DChar.prototype.UpdateROColour = function() {
    if (this.mbShowURL || this.mRTF) {
        this.mInputNode.style.backgroundColor = getARFieldROBg_NS(this.windowID);
        if (this.mbShowURL) {
            this.mDivEditBox.style.backgroundColor = getARFieldROBg_NS(this.windowID)
        }
    } else {
        DChar.superclass.UpdateROColour.call(this)
    }
};
DChar.prototype.SetValue = function(b) {
    if (b && b.length > 0) {
        if (this.isRTF()) {
            this.SetRTFVal(b)
        } else {
            this.mInputNode.value = b
        }
        convertPlainToFormattedText(b, this.mDivEditBox);
        this.mDivEditBox.style.visibility = "visible";
        this.mInputNode.style.visibility = "hidden"
    } else {
        this.mInputNode.value = b;
        this.mDivEditBox.innerHTML = "";
        this.mDivEditBox.style.visibility = "hidden";
        this.mInputNode.style.visibility = "visible"
    }
    this.mPrimVal = b
};
DChar.prototype.GetValue = function() {
    if (this.mDivEditBox && this.mDivEditBox.style.visibility == "visible") {
        return this.innerText()
    }
    if (this.isRTF()) {
        return this.GetRTFVal()
    }
    return this.mInputNode.value
};
DChar.prototype.GetFocusElement = function() {
    if ("mFocusElement" in this) {
        return this.mFocusElement
    }
    var d = this.mObj,
    b = d;
    while (1) {
        if ((b.nodeType == 1) && ((b.tagName == "INPUT") || (b.tagName == "TEXTAREA") || (b.tagName == "IMG") || (b.tagName == "DIV" && b.className.indexOf("text") >= 0))) {
            this.mFocusElement = b;
            return b
        }
        if (b.firstChild) {
            b = b.firstChild
        } else {
            while (!b.nextSibling) {
                b = b.parentNode;
                if (b == d) {
                    this.mFocusElement = null;
                    return null
                }
            }
            b = b.nextSibling
        }
    }
};
function getInnerText(d) {
    var f = d.innerHTML;
    f = f.replace(/<[br]\/?[^>]+>/gi, "\n");
    f = f.replace(/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/gi, "\t");
    f = f.replace(/&nbsp;/gi, " ");
    f = f.replace(/&quot;/g, '"');
    var b = /<\/?[^>]+>/gi;
    f = f.replace(b, "");
    f = f.replace(/&lt;/g, "<");
    f = f.replace(/&gt;/g, ">");
    f = f.replace(/&amp;/g, "&");
    return f
}
function convertPlainToFormattedText(d, b) {
    d = d.replace(/</g, "&lt;");
    d = d.replace(/>/g, "&gt;");
    d = d.replace(/\"/g, "&quot;");
    b.innerHTML = "";
    convertPlainToURL(d, b)
}
function convertPlainToURL(u, s) {
    u = u.replace(/<br>/g, "\n");
    u = u.replace(/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/g, "\t");
    u = u.replace(/&nbsp;/g, " ");
    var g = "((ftp|www|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal)[:.A-Za-z0-9/](([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2})+)";
    var h = new RegExp(g, "gim");
    var b = u.replace(h, "___");
    var d = b.split("___");
    var p = u.match(h);
    var v = new Array();
    var o = u;
    var f = j = 0;
    while (o) {
        if (o.search(h) == 0) {
            var k = new Array();
            k.push("<a target='_blank' href='");
            if (p[f].indexOf("www.") == 0) {
                k.push("http://")
            }
            k.push(p[f]);
            k.push("'>");
            k.push(p[f]);
            k.push("</a>");
            v.push(k.join(""));
            no = p[f].length;
            f++;
            if (no == null) {
                continue
            }
            o = o.replace(o.substring(0, no), "")
        } else {
            var q = d[j];
            q = q.replace(/\n/g, "<br>");
            q = q.replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
            var k = new Array();
            k.push("<SPAN>");
            k.push(q);
            k.push("</SPAN>");
            v.push(k.join(""));
            len = d[j].length;
            j++;
            if (len == null) {
                continue
            }
            o = o.replace(o.substring(0, len), "")
        }
    }
    s.innerHTML = v.join("");
    setTimeout(function() {
        refreshListeners(s)
    },
    10)
}
function updateInnerHTML(b, d) {
    b.innerHTML = d;
    refreshListeners(b)
}
function refreshListeners(f) {
    var b = f.getElementsByTagName("a");
    for (var d = 0; d < b.length; d++) {
        if (b[d].onmouseover == null) {
            if (f.contentEditable == "true") {
                b[d].onmouseover = function() {
                    f.contentEditable = false
                };
                b[d].onmouseout = function() {
                    f.contentEditable = true
                }
            }
            b[d].target = "_blank";
            if (b[d].innerHTML.indexOf("www.") == 0) {
                b[d].href = "http://" + b[d].innerHTML
            }
        }
    }
}
DGroup.prototype = new DChar();
DGroup.prototype.constructor = DGroup;
DGroup.superclass = DChar.prototype;
JGroup.prototype = new JChar();
JGroup.prototype.constructor = JGroup;
JGroup.superclass = JChar.prototype;
TPAGroup.prototype = new TPAChar();
TPAGroup.prototype.constructor = TPAGroup;
TPAGroup.superclass = TPAChar.prototype;
DOMFieldFactories.Group = function(b, f, d) {
    return new DGroup(b, f, d)
};
function DGroup(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAGroup.prototype.ConvertPrimitiveToDataType = DGroup.prototype.ConvertPrimitiveToDataType = function(d) {
    var b = Group_Validate(this.windowID, this.mID, ExpandString(this.windowID, d, 2 | 4), true);
    return new CharType(b.v)
};
DGroup.prototype.ConvertDTForS = DGroup.prototype.ConvertDTForSLE = function(d) {
    var b = Group_Validate(this.windowID, this.mID, ExpandString(this.windowID, d.toString(), 2 | 4), true);
    if (b.w) {
        getCurWFC_NS(this.windowID).status([{
            t: 1,
            n: 9305,
            m: null,
            a: this.GLabelOrName()
        }])
    }
    return new CharType(b.v)
};
DGroup.prototype.SToScreen = function(f, d) {
    if (f.isNull) {
        this.mInputNode.value = ""
    } else {
        var b = Group_Validate(this.windowID, this.mID, f.toString(), false);
        if (b.v) {
            this.mInputNode.value = b.v;
            this.SetDirty(this.mInputNode)
        }
    }
};
DGroup.prototype.Validate = function() {
    var b = Group_Validate(this.windowID, this.mID, ExpandString(this.windowID, this.mInputNode.value, 2 | 4), true);
    if (b.w) {
        return {
            t: 2,
            n: 9305,
            m: null,
            a: this.GLabelOrName()
        }
    }
    return null
};
DGroup.prototype.mNeedSpecialSetToScreen = true;
function ValidateGroup(f, b) {
    var d = -1;
    if (f[b] != null) {
        d = f[b]
    }
    return d
}
function getGroupId(b, g, d) {
    var f = ValidateGroup(getGInfo_NS(b).gNameIdMap, d);
    if (f == -1 && g != 104) {
        f = ValidateGroup(getGInfo_NS(b).cNameIdMap, d)
    }
    return f
}
function getRoleId(b, g, d) {
    if (g == 112 || (g >= 60000 && g <= 60999)) {
        for (var f in getGInfo_NS(b).rIdNameMap) {
            if (d == getGInfo_NS(b).rIdNameMap[f]) {
                return f
            }
        }
    }
    return - 1
}
function getLabel(b, g) {
    var d;
    var f = /\b\d+\b/;
    if (f.test(g)) {
        d = getGInfo_NS(b).getLabel(g);
        if (d && d instanceof Object) {
            return d[0]
        }
    }
    return d
}
function IsValidGroup(b, k, h, d) {
    var o = getRoleId(b, k, h);
    if (o == -1) {
        o = getGroupId(b, k, h)
    }
    if (o != -1) {
        return (d) ? o: h
    }
    if (!d) {
        var f = getLabel(b, h);
        if (f) {
            return f
        }
    }
    if (k != 104) {
        var g = /'[^']*'/;
        if (g.test(h)) {
            return h
        }
    }
    return (isNaN(h) ? null: h)
}
function Group_Validate_UsingSemiColon(f, k, u, h) {
    var s = {},
    w = "",
    d = "";
    var g = u.split(";");
    if (g != null) {
        for (var o = 0; o < g.length; o++) {
            var b = g[o].trim(1 | 2);
            if (b == "") {
                continue
            }
            d = IsValidGroup(f, k, b, h);
            if (!d) {
                if (b.lastIndexOf(" ") != -1) {
                    var q = Group_Validate_UsingSpace(f, k, b, h);
                    d = q.v;
                    if (h) {
                        if (d.charAt(d.length - 1) == ";") {
                            d = d.substring(0, d.length - 1)
                        }
                    }
                } else {
                    s.w = true;
                    d = g[o]
                }
            }
            if (w != "") {
                w += (h) ? ";": " "
            }
            w += d
        }
        if (h) {
            w += ";"
        }
    }
    s.v = w;
    return s
}
function Group_Validate_UsingSpace(f, k, u, h) {
    var p = {},
    w = "",
    d = "";
    var s = u;
    var b = 0,
    o = u.length,
    g;
    while (true) {
        if (b > o) {
            break
        }
        g = s.substring(b, o) + "";
        d = IsValidGroup(f, k, g.trim(1 | 2), h);
        if (!d) {
            var q = g.lastIndexOf(" ");
            if (q != -1) {
                o = b + q;
                continue
            }
            p.w = true;
            d = g
        }
        if (w != "") {
            w += (h) ? ";": " "
        }
        w += d;
        b = o + 1;
        o = u.length
    }
    if (h) {
        w += ";"
    }
    p.v = w;
    return p
}
function Group_Validate(b, o, h, f) {
    var g = {},
    d = h;
    if (h.length > 0) {
        if (h.lastIndexOf(";") != -1) {
            return Group_Validate_UsingSemiColon(b, o, h, f)
        } else {
            if (h.lastIndexOf(" ") != -1) {
                return Group_Validate_UsingSpace(b, o, h, f)
            } else {
                var k = IsValidGroup(b, o, h, f);
                if (k) {
                    d = k;
                    if (f) {
                        d += ";"
                    }
                } else {
                    g.w = true
                }
            }
        }
    }
    g.v = d;
    return g
}
JFieldFactories.Group = function(b, f, d) {
    return new JGroup(b, f, d)
};
function JGroup(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAFieldFactories.Group = function(b, f, d) {
    return new TPAGroup(b, f, d)
};
function TPAGroup(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
JGroup.prototype.G = function() {
    var b = this.mObj.v;
    if (this.mObj.w || b.isNull || b.toString() == "") {
        return CharNull
    }
    this.mObj.v = new CharType(this.mObj.v);
    return this.mObj.v
};
JGroup.prototype.DoSet = JGroup.prototype.DoSLoadEntry = function(d) {
    d = d.toString();
    var b = Group_Validate(this.windowID, this.mID, d, true);
    if (b.w) {
        getCurWFC_NS(this.windowID).status([{
            t: 1,
            n: 9305,
            m: null,
            a: this.GLabelOrName()
        }])
    }
    this.mObj = b;
    this.SetDirty()
};
var DatatypeMap = {
    Attachment: 11,
    Char: 4,
    Currency: 12,
    Date: 13,
    Decimal: 10,
    DefaultKW: 1,
    Diary: 5,
    Display: 43,
    Enum: 6,
    Group: 4,
    Integer: 2,
    Keyword: 1,
    Null: 0,
    Real: 3,
    StatusHistory: 4,
    TOD: 14,
    Time: 7,
    View: 42
};
JColumn.prototype = new Field();
JColumn.prototype.constructor = JColumn;
JColumn.superclass = Field.prototype;
function JColumn(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
JColumn.prototype.mHaveVisualCharacteristics = true;
JColumn.prototype.mIsPageDataField = false;
JColumn.prototype.init = function(k, h, f) {
    this.mData = null;
    JColumn.superclass.init.call(this, k, h, f);
    this.mCFCache.v = true;
    this.mIsPageDataField = (this.mObj.template != null) && (this.mObj.template != "");
    this.mRTF = false;
    this.mRTFAttachmentFieldID = -1;
    if (this.mIsPageDataField) {
        this.mCFCache.l = this.mObj.lbl;
        if (this.mObj.template.indexOf(" rtf ") != -1) {
            var d = document.createElement("TEMP");
            d.innerHTML = this.mObj.template;
            if (d.firstChild && d.firstChild.childNodes && d.firstChild.childNodes.length > 1) {
                var o = d.firstChild.childNodes[2];
                this.mRTF = (o.className.indexOf("rtf") != -1);
                var g = o.getAttribute("arpool");
                if (g != null) {
                    this.mRTFAttachmentFieldID = parseInt(g)
                }
                this.mRTFAdvanced = this.mRTF && ((o.getAttribute("artf") != null) ? true: false)
            }
        }
    }
};
JColumn.prototype.UpdateVis = function(b) {
    getFields_NS(this.windowID)[this.mObj.pnt].SColVis(this.mObj.dataidx, b)
};
JColumn.prototype.UpdateLabel = function(b) {
    getFields_NS(this.windowID)[this.mObj.pnt].SColLabel(this.mObj.dataidx, b)
};
JColumn.prototype.instantiateField = function() {
    if (! ("dataidx" in this.mObj)) {
        return
    }
    var b = getFields_NS(this.windowID)[this.mObj.pnt];
    if (b.mResult) {
        var g = b.mResult.f[this.mObj.dataidx];
        if ((g.t in JFieldFactories) || (this.mIsPageDataField && (g.t in TPAFieldFactories))) {
            if (this.mData) {
                var d = g.dt;
                if ("t" in this.mData) {
                    d = this.mData.t
                }
                g.v = Datatype_Factory({
                    t: d,
                    v: this.mData.p,
                    a: g.a
                })
            } else {
                g.v = Null
            }
            if (this.mIsPageDataField) {
                if ((g.t == "Enum") && ("et" in this.mObj) && (this.mObj.et == 0)) {
                    this.mField = TPAFieldFactories[g.t + "Sel"](this.windowID, 0, g)
                } else {
                    this.mField = TPAFieldFactories[g.t](this.windowID, 0, g)
                }
                this.mField.cmid = this.mID;
                this.mField.mCFCache = new CFCacheObj();
                this.mField.mParentid = this.mObj.pnt;
                this.mField.mColid = this.mID;
                if (this.mRTF) {
                    this.mField.mRTF = this.mRTF
                }
                if (this.mRTFAttachmentFieldID) {
                    this.mField.mRTFAttachmentFieldID = this.mRTFAttachmentFieldID
                }
                if (this.mRTFAdvanced) {
                    this.mField.mRTFAdvanced = this.mRTFAdvanced
                }
                if ("m" in this.mCFCache) {
                    this.mField.mCFCache.m = this.mCFCache.m
                }
                if ("a" in this.mCFCache) {
                    this.mField.mCFCache.a = this.mCFCache.a
                }
                if ("l" in this.mCFCache) {
                    this.mField.mCFCache.l = this.mCFCache.l
                }
            } else {
                this.mField = JFieldFactories[g.t](this.windowID, 0, g)
            }
        }
    }
};
JColumn.prototype.G = function() {
    if (!this.mField) {
        this.instantiateField()
    }
    if (this.mField) {
        if (this.mIsPageDataField && this.mField.mObj.t == "View") {
            var d = getFields_NS(this.windowID);
            var f = d[this.mObj.pnt].GetRow();
            if (f >= 0 && d[this.mObj.pnt].mResult) {
                return new CharType(d[this.mObj.pnt].mResult.r[f].d[this.mObj.dataidx].vt)
            }
        }
        var b = this.mField.G();
        return b
    }
    return Null
};
JColumn.prototype.GP = function() {
    if (!this.mField) {
        this.instantiateField()
    }
    if (this.mField) {
        if (this.mIsPageDataField && this.mField.mObj.t == "View") {
            var d = getFields_NS(this.windowID);
            var f = d[this.mObj.pnt].GetRow();
            if (f >= 0 && d[this.mObj.pnt].mResult) {
                return new CharType(d[this.mObj.pnt].mResult.r[f].d[this.mObj.dataidx].vt)
            }
        }
        if (this.mField.mObj.t == "Enum") {
            var b = this.mField.GP()
        } else {
            b = this.mField.G()
        }
        return b
    }
    return Null
};
JColumn.prototype.DoSet = JColumn.prototype.DoSLoadEntry = function(h) {
    if (!this.mField) {
        this.instantiateField()
    }
    if (this.mField) {
        var b = getFields_NS(this.windowID)[this.mObj.pnt];
        var g = b.GetRow();
        if (g >= 0 && g < b.GetRows()) {
            var d = getFieldChanged_NS(this.windowID);
            this.mField.S(h);
            if (b instanceof DPageArray && this.mField.mObj.t == "Enum" && h.type != 6) {
                var f = this.findHtmlObject(g, this.mObj.dataidx);
                if ((f != null) && (typeof this.mField.iterate != "undefined")) {
                    this.mField.iterate(function(p, k) {
                        var o = p.nextSibling.firstChild.data;
                        if (h.mValue == o) {
                            p.checked = true
                        } else {
                            p.checked = false
                        }
                    },
                    f)
                }
            }
            if (!d) {
                Field_ClearChangedFromRunProcess(this.windowID)
            }
            if (! ("mXXXDirty" in b.mResult.r[b.GetRow()])) {
                b.mResult.r[b.GetRow()].mXXXDirty = 1
            }
            if (b instanceof DTreeView) {
                this.mData.p = this.mField.G().toString()
            } else {
                this.mData.p = this.mField.mObj.v
            }
            this.mData.v = this.mField.G().toString();
            this.mData.t = (this.mField.mObj.v.isNull) ? 0 : this.mField.mObj.dt;
            if (this.mIsPageDataField && this.mField.mObj.t == "View") {
                this.mObj.v = this.mField.val;
                b.mResult.r[g].d[this.mObj.dataidx].vt = this.mField.val.toString()
            }
            if ((b instanceof DPageArray) && (this.mData.t == 6)) {
                this.mData.p = this.mField.mObj.v.mValue
            } else {
                b.DataChanged()
            }
            if (typeof AnimMgr != "undefined" && this.mIsPageDataField) {
                b.mHighlight = [];
                b.mHighlight.push({
                    r: g,
                    c: this.mObj.dataidx
                })
            }
        }
    }
};
JColumn.prototype.findHtmlObject = function(d) {
    var b = getFields_NS(this.windowID)[this.mObj.pnt];
    return b.findHtmlObject(d, this.mObj.dataidx)
};
JColumn.prototype.GetDataPortion = function() {
    var d = getFields_NS(this.windowID)[this.mObj.pnt];
    var f = d.GetRow();
    var b = this.findHtmlObject(f);
    return b.childNodes[2]
};
JColumn.prototype.mHaveStoredData = false;
JColumn.prototype.GDefault = function() {
    return null
};
JColumn.prototype.Clear = function() {};
JColumn.prototype.Refresh = function() {
    if (this.mField) {
        var b = getFields_NS(this.windowID)[this.mObj.pnt];
        if (b.mResult) {
            var d = b.mResult.f[this.mObj.dataidx];
            if (d.t != this.mField.type) {
                delete this.mField
            } else {}
        }
    }
};
JColumn.prototype.Update = function(k, g) {
    this.mData = k;
    if (this.mData && typeof this.mData != "undefined" && this.mRTF && this.mData.p != "undefined" && this.mData.p) {
        this.mData.p = updateRtfHtml(this.windowID, this.mData.p, g)
    }
    if (this.mField) {
        if (this.mData) {
            var b = getFields_NS(this.windowID)[this.mObj.pnt];
            var h = b.mResult.f[this.mObj.dataidx];
            var d = h.dt;
            if ("t" in this.mData) {
                d = this.mData.t
            }
            this.mField.mObj.v = Datatype_Factory({
                t: d,
                v: this.mData.p,
                a: h.a
            })
        } else {
            this.mField.mObj.v = Null
        }
    }
};
JColumn.prototype.getTable = function() {
    var b = F(this.windowID, this.mObj.pnt);
    return b
};
JColumn.prototype.GetSorter = function() {
    if (!this.mField) {
        this.instantiateField()
    }
    return this.mField.GetSorter()
};
JColumn.prototype.IsTimeRelatedField = function() {
    if (!this.mField) {
        this.instantiateField()
    }
    return (this.mField instanceof JDate || this.mField instanceof JTime || this.mField instanceof JTOD)
};
JColumn.prototype.GetType = function() {
    if ("dataidx" in this.mObj) {
        var b = getFields_NS(this.windowID)[this.mObj.pnt];
        if (b.mResult) {
            var d = b.mResult.f[this.mObj.dataidx];
            if (d.t in DatatypeMap) {
                return DatatypeMap[d.t]
            }
        }
    }
    return 0
};
JColumn.prototype.GetDataField = function() {
    if (!this.mField) {
        this.instantiateField()
    }
    return this.mField
};
JColumn.prototype.DOMClick = function(b) {
    if (typeof rtfEditor != "undefined" && rtfEditor != null && rtfEditor.mEditing != null && rtfEditor.mEditing != b.element) {
        this.HideRTF(true)
    }
    var d = this.GetDataField();
    if ((d instanceof TPAInteger) || (d instanceof TPADecimal) || (d instanceof TPAReal)) {
        return
    }
    if ((d instanceof TPAControl) || (d instanceof TPAEnumSel) || (d instanceof TPAEnum)) {
        return d.DOMClick(b, this.mID)
    }
    if (d.isRTF && d.isRTF() && !d.mInputNode && b.element) {
        var f = b.element;
        while (f && f.parentNode && f.tagName != "DIV" && f.className.indexOf("rtf") == -1) {
            f = f.parentNode
        }
        d.mInputNode = f
    }
    return d.DOMClick(b)
};
JColumn.prototype.DOMMouseDown = function(b) {
    var d = this.GetDataField();
    if (d instanceof TPAInteger) {
        return d.DOMMouseDown(b, this.mID)
    }
};
JColumn.prototype.DOMMouseUp = function(b) {
    var d = this.GetDataField();
    if (d instanceof TPAInteger) {
        return d.DOMMouseUp(b, this.mID)
    }
};
JColumn.prototype.DOMMouseOut = function(b) {
    var d = this.GetDataField();
    if (d instanceof TPAInteger) {
        return d.DOMMouseOut(b, this.mID)
    }
};
JColumn.prototype.DOMKeyPress = function(b) {
    var d = this.GetDataField();
    if (d instanceof TPAChar) {
        return d.DOMKeyPress(b)
    }
};
JColumn.prototype.DOMKeyDown = function(b) {
    var d = this.GetDataField();
    if (d instanceof TPAChar) {
        return d.DOMKeyDown(b)
    }
};
JColumn.prototype.DOMFocus = function(b) {
    var d = this.GetDataField();
    if (d instanceof TPAChar) {
        return d.DOMFocus(b)
    }
};
JColumn.prototype.FieldValChanged = function(d, g) {
    var f = this.GetDataField();
    if (typeof g == "undefined" && (f instanceof TPAEnum || f instanceof TPAEnumSel)) {
        return
    }
    var b = f.FieldValChanged(d, g);
    if (f.mDataVal != null) {
        this.DoSet(f.mDataVal)
    }
    return b
};
JColumn.prototype.getRowInScroll = function(b) {
    var d = this.getTable();
    return d.getRowInScroll(b)
};
JColumn.prototype.GetHoverValue = function(b) {
    var f = this.getTable();
    var h = null;
    if (b.element.className == "BaseTableInner") {
        h = this.getRowInScroll(b)
    } else {
        h = f.MapUIX(b.element)
    }
    if (h == null) {
        return ""
    }
    var f = this.getTable();
    var d = f.getColNum(this.mID);
    if (d == -1) {
        return ""
    }
    var g = f.GetData();
    return g[h].d[d].v
};
JColumn.prototype.hasImgRef = function() {
    if (this.mObj.irv != undefined) {
        return true
    } else {
        return false
    }
};
JColumn.prototype.getImgW = function(b) {
    if (this.mObj.irv != undefined) {
        var d = this.mObj.irv[b];
        if (d != null && d.irw != undefined) {
            return d.irw
        }
    }
    return 0
};
JColumn.prototype.getImgH = function(b) {
    if (this.mObj.irv != undefined) {
        var d = this.mObj.irv[b];
        if (d != null && d.irh != undefined) {
            return d.irh
        }
    }
    return 0
};
JColumn.prototype.getImgURL = function(b) {
    if (this.mObj.irv != undefined) {
        var d = this.mObj.irv[b];
        if (d != null) {
            return (d.ir == "") ? null: d.ir
        }
    }
    return null
};
JColumn.prototype.getImgFid = function() {
    if (this.mObj.irv != undefined && this.mObj.irf != undefined) {
        return this.mObj.irf
    } else {
        return 0
    }
};
JColumn.prototype.getImgAltT = function(b) {
    if (this.mObj.irv != undefined) {
        var d = this.mObj.irv[b];
        if (d != null && d.iat != undefined) {
            return d.iat
        }
    }
    return null
};
JColumn.prototype.getImgFType = function(b) {
    if (this.mObj.irv != undefined) {
        var d = this.mObj.irv[b];
        if (d != null) {
            return (d.irf == "") ? null: d.irf
        }
    }
    return null
};
JColumn.prototype.hasCellColor = function() {
    if (this.mObj.ccf != undefined) {
        return true
    } else {
        return false
    }
};
JColumn.prototype.getCColorFid = function() {
    if (this.mObj.ccf != undefined && this.mObj.cc != undefined) {
        return this.mObj.ccf
    } else {
        return 0
    }
};
JColumn.prototype.getCColor = function(d) {
    if (this.mObj.cc != undefined) {
        var b = this.mObj.cc[d];
        return b
    }
    return null
};
DInteger.prototype = new DataField();
DInteger.prototype.constructor = DInteger;
DInteger.superclass = DataField.prototype;
JInteger.prototype = new Field();
JInteger.prototype.constructor = JInteger;
JInteger.superclass = Field.prototype;
TPAInteger.prototype = new Field();
TPAInteger.prototype.constructor = TPAInteger;
TPAInteger.superclass = Field.prototype;
DOMFieldFactories.Integer = function(b, f, d) {
    return new DInteger(b, f, d)
};
function DInteger(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DInteger.prototype.init = function(b, f, d) {
    if (d.getAttribute("artype") == "Integer") {
        this.mInputNode = d.childNodes[2].childNodes[1]
    }
    if (!this.mInputNode.getAttribute("armin")) {
        this.mInputNode.setAttribute("armin", "" + -2147483647)
    }
    if (!this.mInputNode.getAttribute("armax")) {
        this.mInputNode.setAttribute("armax", "" + 2147483647)
    }
    DInteger.superclass.init.call(this, b, f, d)
};
DInteger.prototype.ConvertPrimitiveToDataType = function(b) {
    return this.FromUIInput(b, false, false)
};
TPAInteger.prototype.FromUIInput = JInteger.prototype.FromUIInput = DInteger.prototype.FromUIInput = function(g, f, d) {
    if (d) {
        g = ExpandString(this.windowID, g, 2 | 4, this.mID, 2)
    }
    if (g == "") {
        return Null
    }
    g = g.trim(1 | 2);
    if (f) {
        var b = /^[+-]?[0-9]+$/;
        if (!b.test(g)) {
            throw ({
                t: 2,
                n: 9375,
                m: null,
                a: '"' + g + '": ' + this.GLabelOrName()
            })
        }
        var h = parseFloat(g);
        if (h < -2147483647 || h > 2147483647) {
            throw ({
                t: 2,
                n: 9272,
                m: null,
                a: "" + -2147483647 + "," + 2147483647 + " : " + this.GLabelOrName()
            })
        }
    }
    return new IntegerType(g)
};
TPAInteger.prototype.FieldValChanged = function(b) {
    var d = this.GetScreenValAsPrimitive(b);
    if (typeof d == "undefined" || this.mPrimVal == d) {
        return
    }
    this.mPrimVal = d;
    if (d != "" || d == "undefined") {
        this.mDataVal = new IntegerType(d)
    }
    this.DoSet(this.mDataVal)
};
TPAInteger.prototype.GetScreenValAsPrimitive = function(d) {
    if (d != null) {
        return d.element.value
    }
    if (this.mInputNode == null) {
        if (d == null) {
            return ""
        } else {
            var b = d.element.parentNode;
            this.mInputNode = b.childNodes[2];
            if (this.mInputNode == null) {
                return ""
            }
        }
    }
    return this.mInputNode.value
};
DInteger.prototype.GetQBEValue = function() {
    if (this.IsNullKeyword()) {
        return NullType.KEYWORD_NULL
    }
    var g = this.mInputNode.value;
    g = ExpandString(this.windowID, g, 2 | 4, this.mID, 2);
    if (g == "") {
        return Null
    }
    var d = Field.GetQBEOperator(g);
    if (d == null) {
        var b = this.Validate();
        if (b) {
            throw (b)
        }
        return this.G()
    } else {
        var f = this.FromUIInput(g.substring(d.length).trim(1), true, false);
        return new CharType(d + f.toPrimitive())
    }
};
TPAInteger.prototype.ConvertDTForS = TPAInteger.prototype.ConvertDTForSLE = JInteger.prototype.ConvertDTForS = JInteger.prototype.ConvertDTForSLE = DInteger.prototype.ConvertDTForS = DInteger.prototype.ConvertDTForSLE = function(b) {
    if (b.isNull || b.type == 2) {
        return b
    }
    var b = b.toInteger();
    if (!b.isNull) {
        b = new IntegerType(b)
    }
    return b
};
DInteger.prototype.Validate = function() {
    var f = this.mInputNode;
    var d = parseInt(f.getAttribute("armin"), 10);
    var b = parseInt(f.getAttribute("armax"), 10);
    try {
        var h = this.FromUIInput(f.value, true, true);
        return Integer_Validate(this, h, d, b)
    } catch(g) {
        return g
    }
};
DInteger.prototype.mDataType = 2;
JFieldFactories.Integer = function(b, f, d) {
    return new JInteger(b, f, d)
};
function JInteger(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
JInteger.prototype.init = function(b, f, d) {
    JInteger.superclass.init.call(this, b, f, d);
    if (! ("min" in this.mObj)) {
        this.mObj.min = -2147483647
    }
    if (! ("max" in this.mObj)) {
        this.mObj.max = 2147483647
    }
};
TPAFieldFactories.Integer = function(b, f, d) {
    return new TPAInteger(b, f, d)
};
function TPAInteger(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAInteger.prototype.init = function(b, f, d) {
    TPAInteger.superclass.init.call(this, b, f, d);
    if (! ("min" in this.mObj)) {
        this.mObj.min = -2147483647
    }
    if (! ("max" in this.mObj)) {
        this.mObj.max = 2147483647
    }
};
TPAInteger.prototype.G = JInteger.prototype.G = function() {
    var b = this.mObj.v;
    if (b.isNull || b.type == 2) {
        return b
    } else {
        this.mObj.v = new IntegerType(b);
        return this.mObj.v
    }
};
TPAInteger.prototype.DoSet = TPAInteger.prototype.DoSLoadEntry = JInteger.prototype.DoSet = JInteger.prototype.DoSLoadEntry = function(d) {
    this.mObj.v = (d.isNull) ? Null: d;
    if (this.mInputNode != null) {
        var b;
        if (d.isNull) {
            this.mDataVal = Null;
            b = ""
        } else {
            d = this.ConvertDTForS(d);
            b = d.toString();
            if (b == "") {
                this.mDataVal = Null
            } else {
                this.mDataVal = d
            }
        }
        this.mPrimVal = b;
        this.mInputNode.value = b;
        return
    }
    this.SetDirty()
};
TPAInteger.prototype.Validate = JInteger.prototype.Validate = function() {
    return Integer_Validate(this, this.G(), this.mObj.min, this.mObj.max)
};
TPAInteger.prototype.GetSorter = JInteger.prototype.GetSorter = function() {
    return "(ls=parseInt(lhs),rs=parseInt(rhs),(isNaN(ls)?0:ls)-(isNaN(rs)?0:rs))"
};
DInteger.prototype.mHaveStoredData = TPAInteger.prototype.mHaveStoredData = JInteger.prototype.mHaveStoredData = true;
function Integer_Validate(g, h, d, b) {
    var f = g.IsDirty();
    if (!f) {
        return null
    }
    if (!h.isNull) {
        h = h.toInteger();
        if (h < d || h > b) {
            return {
                t: 2,
                n: 9272,
                m: null,
                a: "" + d + "," + b + " : " + g.GLabelOrName()
            }
        }
    }
    return null
}
DInteger.prototype.HighlightBorder = function() {
    var b = this.mInputNode.parentNode;
    b.className += " bHighlight";
    getStateMgr_NS(this.windowID).highlightedFlds.push(this.mID)
};
DInteger.prototype.RemoveHighlightBorder = function() {
    this.mInputNode.parentNode.className = this.mInputNode.parentNode.className.replace("bHighlight", "")
};
TPAInteger.prototype.DOMMouseOut = DInteger.prototype.DOMMouseOut = function(b, d) {
    hoverState.eventMouseOut(b);
    if (this.GAccess() != 2) {
        return false
    }
    var f = FakeButton_Find(b.element);
    if (f) {
        if (this instanceof TPAInteger) {
            this.mInputNode = f.parentNode.childNodes[1];
            this.Spin(0, true, d)
        } else {
            this.Spin(0)
        }
    }
};
TPAInteger.prototype.DOMMouseUp = DInteger.prototype.DOMMouseUp = function(b, d) {
    if (this.GAccess() != 2) {
        return false
    }
    var f = FakeButton_Find(b.element);
    if (f) {
        if (this instanceof TPAInteger) {
            this.mInputNode = f.parentNode.childNodes[1];
            this.Spin(0, true, d)
        } else {
            this.Spin(0)
        }
        promptBar.setToClear();
        new WorkflowContext(this.windowID, {
            f: ExecuteWorkflow,
            a: [this.windowID, 2, this.mID]
        })
    }
};
TPAInteger.prototype.DOMMouseDown = DInteger.prototype.DOMMouseDown = function(b, d) {
    if (this.GAccess() != 2) {
        return false
    }
    var f = FakeButton_Find(b.element);
    if (f) {
        if (this instanceof TPAInteger) {
            this.mInputNode = f.parentNode.childNodes[1];
            if (f.className.indexOf("spinnerup") != -1) {
                this.Spin(1, true, d)
            } else {
                if (f.className.indexOf("spinnerdown") != -1) {
                    this.Spin( - 1, true, d)
                }
            }
        } else {
            if (f.className.indexOf("spinnerup") != -1) {
                this.Spin(1, true)
            } else {
                if (f.className.indexOf("spinnerdown") != -1) {
                    this.Spin( - 1, true)
                }
            }
        }
    }
};
TPAInteger.prototype.DOMKeyDown = DInteger.prototype.DOMKeyDown = function(b) {
    if (this.GAccess() != 2) {
        return
    }
    var g = b.key;
    if (g == 13 || g == 16 || g == 17 || b.ctrl) {
        return
    }
    var k = /^[\+\-0-9]{0,10}$/;
    var o = this.mInputNode;
    var f = (o.getAttribute("arspinner") != null) ? true: false;
    if (g == 8 || g == 46 || g == 37 || g == 39) {
        return
    }
    if (g == 38 || g == 40) {
        b.StopDefault();
        this.Spin((g == 38) ? 1 : -1, false)
    } else {
        var h = "";
        switch (g) {
        case 189:
            h = "-";
            break;
        case 109:
            h = "-";
            break;
        case 187:
            h = "+";
            break;
        case 107:
            h = "+";
            break;
        default:
            h = String.fromCharCodeWithNumPad(g)
        }
        var d = this.mInputNode.value + h;
        if (f && !k.test(d)) {
            b.StopDefault()
        }
    }
};
function DInteger_DoSpin(f, b, d) {
    F(b, f).Spin(d, true)
}
function TPAInteger_DoSpin(h, b, d) {
    var g = F(b, h);
    if (typeof g.mField != "undefined") {
        g.mField.Spin(d, true, h)
    }
}
DInteger.prototype.Spin = function(d, b) {
    if (d == 0) {
        if (this.mSpinTimeout) {
            clearTimeout(this.mSpinTimeout)
        }
    } else {
        if (b) {
            this.mSpinTimeout = setTimeout("DInteger_DoSpin(" + this.mID + "," + this.windowID + "," + d + ")", 250)
        }
        var f = new IntegerType();
        f.ADD(this.G(), new IntegerType(d));
        this.S(f)
    }
};
TPAInteger.prototype.Spin = function(g, b, d) {
    if (g == 0) {
        var h = F(this.windowID, d);
        if ((typeof h != "undefined") && (typeof h.mField != "undefined") && h.mField.mSpinTimeout) {
            clearTimeout(h.mField.mSpinTimeout)
        }
    } else {
        if (b) {
            this.mSpinTimeout = setTimeout("TPAInteger_DoSpin(" + d + "," + this.windowID + "," + g + ")", 250)
        }
        var k = new IntegerType();
        k.ADD(this.G(), new IntegerType(g));
        this.S(k)
    }
};
DDate.prototype = new DataField();
DDate.prototype.constructor = DDate;
DDate.superclass = DataField.prototype;
JDate.prototype = new Field();
JDate.prototype.constructor = JDate;
JDate.superclass = Field.prototype;
TPADate.prototype = new Field();
TPADate.prototype.constructor = TPADate;
TPADate.superclass = Field.prototype;
Date.prototype.UnixTimestamp = function() {
    return Math.floor(this.valueOf() / 1000)
};
DOMFieldFactories.Date = function(b, f, d) {
    return new DDate(b, f, d)
};
function DDate(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DDate.prototype.init = function(b, f, d) {
    this.mInputNode = d.childNodes[2];
    DDate.superclass.init.call(this, b, f, d)
};
TPADate.prototype.ConvertPrimitiveToDataType = DDate.prototype.ConvertPrimitiveToDataType = function(f) {
    var b = this.FromUIInput(f, false, false);
    return b
};
DDate.prototype.GetQBEValue = function() {
    if (this.IsNullKeyword()) {
        return NullType.KEYWORD_NULL
    }
    var g = this.mInputNode.value;
    g = ExpandString(this.windowID, g, 2 | 4, this.mID, 13);
    if (g == "") {
        return Null
    }
    var d = Field.GetQBEOperator(g);
    if (d == null) {
        var b = this.Validate();
        if (b) {
            throw (b)
        }
        return this.G()
    } else {
        var f = this.FromUIInput(g.substring(d.length).trim(1), true, false);
        return new CharType(d + f.toPrimitive())
    }
};
TPADate.prototype.FromUIInput = DDate.prototype.FromUIInput = function(g, f, d) {
    if (d) {
        g = ExpandString(this.windowID, g, 2 | 4, this.mID, 13)
    }
    g = g.trim(1 | 2);
    if (g == "") {
        return Null
    }
    var b = ARDate.parseDate(g);
    if (b == null) {
        if (f && !g.isNumeric()) {
            throw ({
                t: 2,
                n: 9376,
                m: null,
                a: this.GLabelOrName()
            })
        }
        g = parseInt(g, 10);
        if (isNaN(g)) {
            g = 0
        } else {
            if (g < 0) {
                g = 0
            } else {
                if (g > 5373120) {
                    g = 5373120
                }
            }
        }
    } else {
        if (f && b.year == 1582 && b.month == 9 && (b.date > 4 && b.date < 15)) {
            throw ({
                t: 2,
                n: 9376,
                m: null,
                a: this.GLabelOrName()
            })
        }
        g = b.GDays()
    }
    return new DateType(g)
};
TPADate.prototype.ConvertDTForS = JDate.prototype.ConvertDTForS = DDate.prototype.ConvertDTForS = DDate.prototype.ConvertDTForSLE = function(b) {
    if (b.isNull || b.type == 13) {
        return b
    } else {
        if (ARKWIsKeywordString(this.windowID, b)) {
            return new CharType(b.toString())
        } else {
            b = b.toDate();
            if (!b.isNull) {
                b.set(b.toInteger())
            }
            return b
        }
    }
};
DDate.prototype.Validate = function() {
    try {
        return Date_Validate(this, this.FromUIInput(this.mInputNode.value, true, true))
    } catch(b) {
        b.a = this.GLabel();
        return b
    }
};
DDate.prototype.mHaveStoredData = true;
DDate.prototype.mDataType = 13;
TPADate.prototype.ValidatePopupValue = JDate.prototype.ValidatePopupValue = DDate.prototype.ValidatePopupValue = function(b) {
    b = new DateType(b.GDays());
    return Date_Validate(this, b)
};
TPADate.prototype.SetFromPopup = JDate.prototype.SetFromPopup = DDate.prototype.SetFromPopup = function(d) {
    if (this instanceof TPADate) {
        var b = new FormEvent(this.windowID, this.mParentid);
        b.element = this.mInputNode;
        getFields_NS(this.windowID)[this.mParentid].FieldValChanged(b, new DateType(d.GDays()))
    } else {
        this.S(new DateType(d.GDays()))
    }
};
JFieldFactories.Date = function(b, f, d) {
    return new JDate(b, f, d)
};
function JDate(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
TPAFieldFactories.Date = function(b, f, d) {
    return new TPADate(b, f, d)
};
function TPADate(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
TPADate.prototype.G = JDate.prototype.G = function() {
    var b = this.mObj.v;
    if (b.isNull || b.type == 13) {
        return b
    } else {
        if (b.type == 4) {
            b = ExpandString(this.windowID, b.toString(), 2 | 4, this.mID, this.mDataType)
        }
        this.mObj.v = new DateType(b);
        return this.mObj.v
    }
};
TPADate.prototype.DoSet = JDate.prototype.DoSet = function(d) {
    if (d.isNull) {
        this.mObj.v = Null
    } else {
        if (ARKWIsKeywordString(this.windowID, d)) {
            this.mObj.v = new CharType(d.toString())
        } else {
            d = d.toDate();
            if (!d.isNull) {
                d.set(d.toInteger())
            }
            this.mObj.v = d
        }
    }
    if (this.mInputNode != null) {
        var b;
        if (this.mObj.v.isNull) {
            b = ""
        } else {
            b = this.ConvertDTForS(this.mObj.v).toString()
        }
        this.mPrimVal = b;
        this.mInputNode.value = b;
        return
    }
    this.SetDirty()
};
TPADate.prototype.Validate = JDate.prototype.Validate = function() {
    return Date_Validate(this, this.G())
};
function Date_Validate(d, f) {
    var b = d.mLastChanged && getField_LastCleared_NS(d.windowID) <= d.mLastChanged;
    if (!b) {
        return null
    }
    if (!f.isNull) {
        if (f.valueAdjusted) {
            return {
                t: 2,
                n: 9376,
                m: null,
                a: d.GLabelOrName()
            }
        }
    }
    return null
}
TPADate.prototype.mHaveStoredData = JDate.prototype.mHaveStoredData = true;
TPADate.prototype.FieldValChanged = function(b, f) {
    var d;
    if (f) {
        d = this.ConvertDTForS(f).toString()
    } else {
        d = this.GetScreenValAsPrimitive(b)
    }
    if (this.mPrimVal == d) {
        return
    }
    this.mPrimVal = d;
    if (d == "") {
        this.mDataVal = (this.mDataType == 13) ? TimeNull: Null
    } else {
        var g = {
            hasKeyword: false,
            hasTemporalKeyword: false
        };
        d = ExpandString(this.windowID, d, 2 | 4, this.mID, this.mDataType, g);
        if (g.hasTemporalKeyword) {
            this.mDataVal = null
        } else {
            if (d == "") {
                if (g.hasKeyword) {
                    this.mDataVal = (this.mDataType == 13) ? TimeNullType.KEYWORD_TIME_NULL: NullType.KEYWORD_NULL
                } else {
                    this.mDataVal = (this.mDataType == 13) ? TimerNull: Null
                }
            } else {
                this.mDataVal = this.ConvertPrimitiveToDataType(d)
            }
        }
    }
    this.DoSet(this.mDataVal)
};
TPADate.prototype.GetScreenValAsPrimitive = function(d) {
    if (this.mInputNode == null) {
        if (d == null) {
            return ""
        } else {
            var b = d.element.parentNode;
            this.mInputNode = b.childNodes[2];
            if (this.mInputNode == null) {
                return ""
            }
            this.mMaxLen = this.mInputNode.getAttribute("maxlen")
        }
    }
    return this.mInputNode.value
};
TPADate.prototype.DOMClick = DDate.prototype.DOMClick = function(f) {
    DDate.superclass.DOMClick.call(this, f);
    if (this.GAccess() == 3) {
        return
    }
    var h = FakeButton_Find(f.element);
    if (h) {
        if (h.className.indexOf("expand") != -1) {
            var d = null;
            if (this instanceof TPADate) {
                d = h.parentNode;
                this.mInputNode = d.childNodes[2]
            }
            var g = this.GAccess() == 1;
            if (getOpenDIVPopup_NS(this.windowID) && getOpenDIVPopup_NS(this.windowID).mModal) {
                return
            }
            var b = new TimePopup(this, false, true, true, g, d);
            if (this instanceof TPADate) {
                return b.ShowPopup(h, 3, h.offsetHeight + 3)
            } else {
                return b.ShowPopup(h, 0, h.offsetHeight)
            }
        } else {
            this.mInputNode.focus()
        }
    }
};
DTOD.prototype = new DataField();
DTOD.prototype.constructor = DTOD;
DTOD.superclass = DataField.prototype;
JTOD.prototype = new Field();
JTOD.prototype.constructor = JTOD;
JTOD.superclass = Field.prototype;
TPATOD.prototype = new Field();
TPATOD.prototype.constructor = TPATOD;
TPATOD.superclass = Field.prototype;
DOMFieldFactories.TOD = function(b, f, d) {
    return new DTOD(b, f, d)
};
function DTOD(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DTOD.prototype.init = function(b, f, d) {
    this.mInputNode = d.childNodes[2];
    DTOD.superclass.init.call(this, b, f, d)
};
TPATOD.prototype.ConvertPrimitiveToDataType = DTOD.prototype.ConvertPrimitiveToDataType = function(b) {
    return this.FromUIInput(b, false, false)
};
DTOD.prototype.GetQBEValue = function() {
    if (this.IsNullKeyword()) {
        return NullType.KEYWORD_NULL
    }
    var g = this.mInputNode.value;
    g = ExpandString(this.windowID, g, 2 | 4, this.mID, 14);
    g = g.trim(1 | 2);
    if (g == "") {
        return Null
    }
    var d = Field.GetQBEOperator(g);
    if (d == null) {
        var b = this.Validate();
        if (b) {
            throw (b)
        }
        return this.G()
    } else {
        var f = this.FromUIInput(g.substring(d.length).trim(1), true, false);
        return new CharType(d + f.toPrimitive())
    }
};
TPATOD.prototype.FromUIInput = DTOD.prototype.FromUIInput = function(g, f, d) {
    if (d) {
        g = ExpandString(this.windowID, g, 2 | 4, this.mID, 14)
    }
    g = g.trim(1 | 2);
    if (g == "") {
        return Null
    }
    var b = ARDate.parseTime(g);
    if (b == null) {
        if (f && !g.isNumeric()) {
            throw ({
                t: 2,
                n: 9376,
                m: null,
                a: this.GLabelOrName()
            })
        }
        g = parseInt(g, 10);
        if (isNaN(g)) {
            g = 0
        } else {
            if (g < 24) {
                g *= 3600
            } else {
                if (g > 86399) {
                    g = 86399
                }
            }
        }
    } else {
        g = b.GTimeOfDay()
    }
    return new TODType(g)
};
TPATOD.prototype.ConvertDTForS = JTOD.prototype.ConvertDTForS = DTOD.prototype.ConvertDTForS = DTOD.prototype.ConvertDTForSLE = function(b) {
    if (b.isNull || (b.type == 14 && !(b instanceof TODKWType))) {
        return b
    } else {
        if (ARKWIsKeywordString(this.windowID, b)) {
            return new CharType(b.toString())
        } else {
            return b.toTOD()
        }
    }
};
DTOD.prototype.Validate = function() {
    try {
        return TOD_Validate(this, this.FromUIInput(this.mInputNode.value, true, true))
    } catch(b) {
        b.a = this.GLabel();
        return b
    }
};
DTOD.prototype.HandleMenuSelection = function(b) {};
TPATOD.prototype.ValidatePopupValue = JTOD.prototype.ValidatePopupValue = DTOD.prototype.ValidatePopupValue = function(b) {
    b = new TODType((b.GHour() * 3600) + (b.GMinute() * 60) + b.GSecond());
    return TOD_Validate(this, new TODType(b))
};
TPATOD.prototype.SetFromPopup = JTOD.prototype.SetFromPopup = DTOD.prototype.SetFromPopup = function(d) {
    if (this instanceof TPATOD) {
        var b = new FormEvent(this.windowID, this.mParentid);
        b.element = this.mInputNode;
        getFields_NS(this.windowID)[this.mParentid].FieldValChanged(b, new TODType((d.GHour() * 3600) + (d.GMinute() * 60) + d.GSecond()))
    } else {
        this.S(new TODType((d.GHour() * 3600) + (d.GMinute() * 60) + d.GSecond()))
    }
};
DTOD.prototype.mHaveStoredData = true;
DTOD.prototype.mDataType = 14;
JFieldFactories.TOD = function(b, f, d) {
    return new JTOD(b, f, d)
};
function JTOD(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
TPAFieldFactories.TOD = function(b, f, d) {
    return new TPATOD(b, f, d)
};
function TPATOD(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
TPATOD.prototype.G = JTOD.prototype.G = function() {
    var b = this.mObj.v;
    if (b.isNull || b.type == 14) {
        return b
    } else {
        if (b.type == 4) {
            b = ExpandString(this.windowID, b.toString(), 2 | 4, this.mID, this.mDataType)
        }
        this.mObj.v = new TODType(b);
        return this.mObj.v
    }
};
TPATOD.prototype.DoSet = TPATOD.prototype.DoSLoadEntry = JTOD.prototype.DoSet = JTOD.prototype.DoSLoadEntry = function(d) {
    if (d.isNull) {
        this.mObj.v = Null
    } else {
        if (ARKWIsKeywordString(this.windowID, d)) {
            this.mObj.v = new CharType(d.toString())
        } else {
            this.mObj.v = d.toTOD()
        }
    }
    if (this.mInputNode != null) {
        var b;
        if (this.mObj.v.isNull) {
            b = ""
        } else {
            b = this.ConvertDTForS(this.mObj.v).toString()
        }
        this.mPrimVal = b;
        this.mInputNode.value = b;
        return
    }
    this.SetDirty()
};
TPATOD.prototype.Validate = JTOD.prototype.Validate = function() {
    var b = this.G();
    if (b.isNull) {
        return null
    }
    return TOD_Validate(this, b)
};
function TOD_Validate(d, f) {
    var b = d.mLastChanged && getField_LastCleared_NS(d.windowID) <= d.mLastChanged;
    if (!b) {
        return null
    }
    if (!f.isNull) {
        if (f.valueAdjusted) {
            return {
                t: 2,
                n: 9376,
                m: null,
                a: d.GLabelOrName()
            }
        }
    }
    return null
}
TPATOD.prototype.mHaveStoredData = JTOD.prototype.mHaveStoredData = true;
TPATOD.prototype.FieldValChanged = function(b, f) {
    var d;
    if (f) {
        d = this.ConvertDTForS(f).toString()
    } else {
        d = this.GetScreenValAsPrimitive(b)
    }
    if (this.mPrimVal == d) {
        return
    }
    this.mPrimVal = d;
    if (d == "") {
        this.mDataVal = (this.mDataType == 14) ? TimeNull: Null
    } else {
        var g = {
            hasKeyword: false,
            hasTemporalKeyword: false
        };
        d = ExpandString(this.windowID, d, 2 | 4, this.mID, this.mDataType, g);
        if (g.hasTemporalKeyword) {
            this.mDataVal = null
        } else {
            if (d == "") {
                if (g.hasKeyword) {
                    this.mDataVal = (this.mDataType == 14) ? TimeNullType.KEYWORD_TIME_NULL: NullType.KEYWORD_NULL
                } else {
                    this.mDataVal = (this.mDataType == 14) ? TimerNull: Null
                }
            } else {
                this.mDataVal = this.ConvertPrimitiveToDataType(d)
            }
        }
    }
    this.DoSet(this.mDataVal)
};
TPATOD.prototype.GetScreenValAsPrimitive = function(d) {
    if (this.mInputNode == null) {
        if (d == null) {
            return ""
        } else {
            var b = d.element.parentNode;
            this.mInputNode = b.childNodes[2];
            if (this.mInputNode == null) {
                return ""
            }
            this.mMaxLen = this.mInputNode.getAttribute("maxlen")
        }
    }
    return this.mInputNode.value
};
TPATOD.prototype.DOMClick = DTOD.prototype.DOMClick = function(f) {
    DTOD.superclass.DOMClick.call(this, f);
    if (this.GAccess() == 3) {
        return
    }
    var h = FakeButton_Find(f.element);
    if (h) {
        if (h.className.indexOf("expand") != -1) {
            var d = null;
            if (this instanceof TPATOD) {
                d = h.parentNode;
                this.mInputNode = d.childNodes[2]
            }
            var g = this.GAccess() == 1;
            if (getOpenDIVPopup_NS(this.windowID) && getOpenDIVPopup_NS(this.windowID).mModal) {
                return
            }
            var b = new TimePopup(this, true, false, false, g, d);
            if (this instanceof TPATOD) {
                return b.ShowPopup(h, 3, h.offsetHeight + 3)
            } else {
                return b.ShowPopup(h, 0, h.offsetHeight)
            }
        } else {
            this.mInputNode.focus()
        }
    }
};
DDecimal.prototype = new DataField();
DDecimal.prototype.constructor = DDecimal;
DDecimal.superclass = DataField.prototype;
JDecimal.prototype = new Field();
JDecimal.prototype.constructor = JDecimal;
JDecimal.superclass = Field.prototype;
TPADecimal.prototype = new Field();
TPADecimal.prototype.constructor = TPADecimal;
TPADecimal.superclass = Field.prototype;
DOMFieldFactories.Decimal = function(b, f, d) {
    return new DDecimal(b, f, d)
};
function DDecimal(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DDecimal.prototype.init = function(b, f, d) {
    this.mInputNode = d.childNodes[2];
    DDecimal.superclass.init.call(this, b, f, d)
};
DDecimal.prototype.mHaveStoredData = true;
DDecimal.prototype.ConvertPrimitiveToDataType = function(b) {
    return this.FromUIInput(b, false, false)
};
DDecimal.prototype.GetQBEValue = function() {
    if (this.IsNullKeyword()) {
        return NullType.KEYWORD_NULL
    }
    var g = this.mInputNode.value;
    g = ExpandString(this.windowID, g, 2 | 4, this.mID, 10);
    g = g.trim(1 | 2);
    if (g == "") {
        return Null
    }
    var d = Field.GetQBEOperator(g);
    if (d == null) {
        var b = this.Validate();
        if (b) {
            throw (b)
        }
        return this.G()
    } else {
        var f = this.FromUIInput(g.substring(d.length).trim(1), true, false);
        return new CharType(d + f.toPrimitive())
    }
};
DDecimal.prototype.FromUIInput = function(h, g, b) {
    if (b) {
        h = ExpandString(this.windowID, h, 2 | 4, this.mID, 10)
    }
    h = h.trim(1 | 2);
    if (h == "") {
        return Null
    }
    h = LCDecimalToEn_US(h, g);
    var f = parseInt(this.mInputNode.getAttribute("arprecision"));
    try {
        h = new BigDecimal(h);
        if (h.scale() < f) {
            h = h.setScale(f)
        }
    } catch(d) {
        if (g) {
            throw ({
                t: 2,
                n: 9374,
                m: null,
                a: this.GLabelOrName()
            })
        } else {
            h = new BigDecimal("0")
        }
    }
    return new DecimalType(h, f)
};
DDecimal.prototype.ConvertDTForS = DDecimal.prototype.ConvertDTForSLE = function(d) {
    if (d.isNull) {
        return d
    } else {
        var b = parseInt(this.mInputNode.getAttribute("arprecision"));
        if (d instanceof DecimalType && d.mPrecision == b) {
            return d
        }
        return new DecimalType(DecimalType.Round(d.toDecimal(), b), b)
    }
};
TPADecimal.prototype.GDefault = DDecimal.prototype.GDefault = JDecimal.prototype.GDefault = function() {
    if ("d" in getDefaults_NS(this.windowID)[this.mID]) {
        return (new DecimalType(new BigDecimal(getDefaults_NS(this.windowID)[this.mID].d)))
    } else {
        return (Null)
    }
};
DDecimal.prototype.mDataType = 10;
DDecimal.prototype.Validate = function() {
    var g = this.mInputNode;
    var d = new BigDecimal(g.getAttribute("armin"));
    var b = new BigDecimal(g.getAttribute("armax"));
    try {
        var h = this.FromUIInput(g.value, true, true);
        return Decimal_Validate(this, h, d, b)
    } catch(f) {
        f.a += ": " + this.GLabel();
        return f
    }
};
JFieldFactories.Decimal = function(b, f, d) {
    return new JDecimal(b, f, d)
};
function JDecimal(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
JDecimal.prototype.init = function(b, f, d) {
    JDecimal.superclass.init.call(this, b, f, d);
    if (! ("p" in this.mObj)) {
        this.mObj.p = 2
    }
};
TPAFieldFactories.Decimal = function(b, f, d) {
    return new TPADecimal(b, f, d)
};
function TPADecimal(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
TPADecimal.prototype.init = function(b, f, d) {
    TPADecimal.superclass.init.call(this, b, f, d);
    if (! ("p" in this.mObj)) {
        this.mObj.p = 2
    }
};
TPADecimal.prototype.mHaveStoredData = JDecimal.prototype.mHaveStoredData = true;
TPADecimal.prototype.G = JDecimal.prototype.G = function() {
    var b = this.mObj.v;
    if (b instanceof NullType) {
        return b
    } else {
        if (b.type == 10) {
            b.mPrecision = this.mObj.p;
            return b
        } else {
            this.mObj.v = new DecimalType(b, this.mObj.p);
            return this.mObj.v
        }
    }
};
TPADecimal.prototype.DoSet = TPADecimal.prototype.DoSLoadEntry = JDecimal.prototype.DoSet = JDecimal.prototype.DoSLoadEntry = function(b) {
    this.mObj.v = (b.isNull) ? Null: b;
    this.SetDirty()
};
TPADecimal.prototype.Validate = JDecimal.prototype.Validate = function() {
    var b = this.G();
    if (b.isNull) {
        return null
    }
    return Decimal_Validate(this, b, new BigDecimal(this.mObj.min), new BigDecimal(this.mObj.max))
};
function Decimal_Validate(g, h, d, b) {
    var f = g.mLastChanged && getField_LastCleared_NS(g.windowID) <= g.mLastChanged;
    if (!f || h.isNull) {
        return null
    }
    h = h.toDecimal();
    if (d.compareTo(h) > 0 || b.compareTo(h) < 0) {
        return {
            t: 2,
            n: 9272,
            m: null,
            a: "" + d + "," + b + " : " + g.GLabelOrName()
        }
    }
    return null
}
DCurrency.prototype = new DataField();
DCurrency.prototype.constructor = DCurrency;
DCurrency.superclass = DataField.prototype;
JCurrency.prototype = new Field();
JCurrency.prototype.constructor = JCurrency;
JCurrency.superclass = Field.prototype;
TPACurrency.prototype = new Field();
TPACurrency.prototype.constructor = TPACurrency;
TPACurrency.superclass = Field.prototype;
CurrencyMenu.prototype = new Menu();
CurrencyMenu.prototype.constructor = CurrencyMenu;
CurrencyMenu.superclass = Menu.prototype;
function CurrencyMenu(d, b) {
    if (arguments.length) {
        this.init(d, b)
    }
}
CurrencyMenu.prototype.init = function(d, b) {
    CurrencyMenu.superclass.init.call(this, d.windowID, b);
    this.mField = d
};
CurrencyMenu.prototype.Open = function(b) {
    return {
        n: {
            f: CurrencyMenu.superclass.Open,
            t: this,
            a: [b, 3, 30100, false]
        }
    }
};
CurrencyMenu.prototype.HandleSelection = function(b) {
    this.mField.HandleMenuSelection(b);
    promptBar.setToClear();
    new WorkflowContext(this.windowID, {
        f: ExecuteWorkflow,
        a: [this.windowID, 2, this.mField.mID]
    })
};
DOMFieldFactories.Currency = function(b, f, d) {
    return new DCurrency(b, f, d)
};
DCurrency.prototype.mIsComplexField = true;
function DCurrency(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DCurrency.prototype.init = function(windowID, id, n) {
    this.mInputNode = n.childNodes[2];
    var menudef = eval(this.mInputNode.getAttribute("arallowablecur"));
    this.mAllowable = {};
    if (menudef.length == 0) {
        this.mMenuDef = currencyMenu;
        this.mAllowable = getcurrencyCodes_NS(windowID);
        for (var i in getcurrencyCodes_NS(windowID)) {
            this.mDefaultCurrency = i;
            this.mDefaultPrecision = getcurrencyCodes_NS(windowID)[i].p;
            break
        }
    } else {
        for (var i = 0; i < menudef.length; ++i) {
            var label = "";
            if (menudef[i].v in getcurrencyCodes_NS(windowID)) {
                label = " - " + getcurrencyCodes_NS(windowID)[menudef[i].v].l
            }
            menudef[i].l = menudef[i].v + label.HTMLEncode();
            this.mAllowable[menudef[i].v] = {
                p: menudef[i].p,
                l: label
            };
            if (menudef[i].d == "1") {
                this.mDefaultCurrency = menudef[i].v;
                this.mDefaultPrecision = menudef[i].p
            }
        }
        this.mMenuDef = menudef
    }
    if (this.mMenuDef.length == 0) {
        this.mDefaultCurrency = "";
        this.mDefaultPrecision = 2
    }
    menudef = eval(this.mInputNode.getAttribute("arfunctionalcur"));
    this.mFunctional = {};
    for (var i = 0; i < menudef.length; ++i) {
        this.mFunctional[menudef[i].v] = menudef[i].p
    }
    DCurrency.superclass.init.call(this, windowID, id, n);
    var hEvents = [16777216, 8388608, 4194304];
    hasHoverEvt = false;
    var evt = null;
    for (var i = 0; i < hEvents.length; i++) {
        idx = i;
        evt = AREventFunction(windowID, hEvents[i], this.mID);
        if (evt != null) {
            hasHoverEvt = true;
            break
        }
    }
    this.mHasHoverEvt = hasHoverEvt
};
DCurrency.prototype.ConvertPrimitiveToDataType = function(b) {
    return this.FromUIInput(b, false, false)
};
DCurrency.prototype.GetQBEValue = function() {
    if (this.IsNullKeyword()) {
        return NullType.KEYWORD_NULL
    }
    var f = this.mInputNode.value;
    f = ExpandString(this.windowID, f, 2 | 4, this.mID, 12);
    f = f.trim(1 | 2);
    if (f == "") {
        return Null
    }
    var b = Field.GetQBEOperator(f);
    if (b == null) {
        return this.G()
    } else {
        var d = this.FromUIInput(f.substring(b.length).trim(1), true, false);
        return new CharType(b + d.toPrimitive())
    }
};
DCurrency.prototype.DoSLoadEntry = function(b) {
    this.mDataVal = b;
    var d = b.toString();
    this.mPrimVal = d;
    this.mInputNode.value = d;
    this.SetDirty(this.mInputNode)
};
TPACurrency.prototype.FromUIInput = JCurrency.prototype.FromUIInput = DCurrency.prototype.FromUIInput = function(o, k, f) {
    if (f) {
        o = ExpandString(this.windowID, o, 2 | 4, this.mID, 12)
    }
    o = o.trim(1 | 2);
    if (o == "") {
        return Null
    }
    var d = /.*([A-Z][A-Z][A-Z])\s*$/;
    var b = "";
    if (o.match(d)) {
        b = o.replace(d, "$1")
    }
    d = /(.*)[A-Z][A-Z][A-Z]\s*$/;
    o = o.replace(d, "$1");
    o = o.trim(1 | 2);
    o = LCDecimalToEn_US(o, k);
    try {
        o = new BigDecimal(o)
    } catch(h) {
        if (k) {
            throw ({
                t: 2,
                n: 9374,
                m: null,
                a: '"' + o + '"'
            })
        } else {
            o = null
        }
    }
    if (o != null && b == "") {
        b = this.mDefaultCurrency
    }
    var g = this.GetPrecision(b);
    o = new CurrencyType(o, g);
    o.mCurCode = b;
    if (this.mDate == null || typeof(this.mDate) == "undefined") {
        this.mDate = new Date().UnixTimestamp()
    }
    o.mDate = this.mDate;
    return o
};
TPACurrency.prototype.GetPrecision = JCurrency.prototype.GetPrecision = DCurrency.prototype.GetPrecision = function(b) {
    if (b in this.mAllowable) {
        return this.mAllowable[b].p
    }
    return 2
};
TPACurrency.prototype.ConvertDTForS = JCurrency.prototype.ConvertDTForS = DCurrency.prototype.ConvertDTForS = DCurrency.prototype.ConvertDTForSLE = function(d) {
    if (d.type == 12) {
        var b = d.mCurCode;
        if (!b || b == "") {
            b = this.mDefaultCurrency
        }
        this.mDate = d.mDate;
        this.mFunc = {};
        d = new CurrencyType(d, this);
        d.mValue = ((d.mValue == null) ? null: DecimalType.Round(d.mValue, d.mPrecision));
        d.mCurCode = b;
        d = this.SetFunctionals(d);
        return d
    } else {
        if (d.toString() in this.mAllowable) {
            return new CharType(d.toString())
        } else {
            d = d.toCurrency(this);
            if (d.mValue == null) {
                return Null
            }
            if (!d.mCurCode || d.mCurCode == "") {
                d.mCurCode = this.mDefaultCurrency;
                d.mPrecision = this.mDefaultPrecision
            }
            d = this.SetFunctionals(d);
            return d
        }
    }
};
TPACurrency.prototype.SetFunctionals = JCurrency.prototype.SetFunctionals = DCurrency.prototype.SetFunctionals = function(b) {
    b.mFunc = {};
    for (var d in this.mFunctional) {
        b.mFunc[d] = {
            p: this.mFunctional[d]
        }
    }
    if (! (b.mCurCode in this.mAllowable)) {
        b = b.CurrConvert(this.mDefaultCurrency, b.mDate, this.GetPrecision(this.mDefaultCurrency))
    } else {
        b = b.CurrSetDate(b.mDate)
    }
    return b
};
DCurrency.prototype.mHaveStoredData = true;
DCurrency.prototype.mDataType = 12;
TPACurrency.prototype.Validate = JCurrency.prototype.Validate = DCurrency.prototype.Validate = function() {
    var g = this.mInputNode;
    if (!g) {
        return null
    }
    var d = new BigDecimal(g.getAttribute("armin"));
    var b = new BigDecimal(g.getAttribute("armax"));
    try {
        var h = this.FromUIInput(g.value, true, true);
        if (h.isNull) {
            return null
        }
        return Currency_Validate(this, h, d, b)
    } catch(f) {
        f.n = 9325;
        f.a += ": " + this.GLabel();
        return f
    }
};
TPACurrency.prototype.GDefault = DCurrency.prototype.GDefault = JCurrency.prototype.GDefault = function() {
    if ("d" in getDefaults_NS(this.windowID)[this.mID]) {
        return new CharType(En_USRealToLC(ExpandString(this.windowID, "" + getDefaults_NS(this.windowID)[this.mID].d, 2)))
    } else {
        if ((getARStateCurrent_NS(this.windowID) == 1)) {
            var b = ARPrefsGetAsString(20130);
            if (b) {
                return (this.IsAllowable(b) ? new CharType(ARPrefsGetAsString(20130)) : Null)
            } else {
                if (this.GetInitialCurrency() != null) {
                    return (new CharType(this.GetInitialCurrency()))
                }
            }
        }
        return Null
    }
};
DCurrency.prototype.IsAllowable = function(b) {
    return b in this.mAllowable
};
TPACurrency.prototype.IsAllowable = JCurrency.prototype.IsAllowable = function(b) {
    return b in this.mObj.a
};
DCurrency.prototype.GetInitialCurrency = function() {
    return this.mInputNode.getAttribute("ic")
};
TPACurrency.prototype.GetInitialCurrency = JCurrency.prototype.GetInitialCurrency = function() {
    if ("ic" in this.mObj) {
        return this.mObj.ic
    }
    return null
};
CurrencyPopup.prototype = new DIVPopup();
CurrencyPopup.prototype.constructor = CurrencyPopup;
CurrencyPopup.superclass = DIVPopup.prototype;
function CurrencyPopup(b) {
    if (arguments.length) {
        this.init(b)
    }
}
CurrencyPopup.prototype.init = function(b) {
    this.mField = b;
    CurrencyPopup.superclass.init.call(this, b.windowID, true, true, false, false, true);
    this.SetSize(250, 0)
};
CurrencyPopup.prototype.ShowPopup = function(f, d, b) {
    var h = this.mField.G();
    var k = '<div class="scrollCur"><table class="CurTable">';
    if (typeof(this.mField.mDate) != "undefined" && this.mField != null && this.mField.mDate >= 0 && !h.isNull) {
        var g = new TimeType(this.mField.mDate);
        k += "<tr><td nowrap colspan=2 height=25px align=top>" + getLocalizedMessage("Value based on {0}", [g.toString()]) + "</td></tr>"
    }
    for (var p in this.mField.mFunctional) {
        k += "<tr><td class=CurSym>" + p + "</td><td class=CurVal>";
        if (h.mFunc && typeof(h.mFunc) == "object" && p in h.mFunc && "v" in h.mFunc[p] && h.mFunc[p].v != null) {
            var o = DecimalType.Round(h.mFunc[p].v, h.mFunc[p].p);
            k += En_USDecimalToLC(o.toString())
        }
        k += "</td></tr>"
    }
    k += "</table></div>";
    this.SetContents(null, k);
    CurrencyPopup.superclass.ShowPopup.call(this, f, d, b, true)
};
CurrencyPopup.prototype.Buttons = [{
    t: getLocalizedMessage("Close"),
    f: "OnClose",
    id: "ardivpclose"
}];
CurrencyPopup.prototype.OnClose = function() {
    this.HidePopup(true)
};
CurrencyPopup.prototype.HidePopup = function(b) {
    CurrencyPopup.superclass.HidePopup.call(this, true)
};
CurrencyPopup.prototype.ShowSingle = function() {
    return false
};
CurrencyPopup.prototype.GetTitleBarHTML = function(b) {
    return ""
};
TPACurrency.prototype.HandleMenuSelection = DCurrency.prototype.HandleMenuSelection = function(h) {
    h = h.substring(0, 3);
    var g = this.mInputNode.value;
    g = g.trim(1 | 2);
    if (g == "") {
        this.SetScreenValue(h);
        if (! (this instanceof TPACurrency)) {
            this.SetDirty(this.mInputNode)
        }
        return
    }
    var b = /(.*)[A-Z,a-z][A-Z,a-z][A-Z,a-z]$/;
    if (g.match(b)) {
        g = g.replace(b, "$1")
    }
    g = g.trim(1 | 2);
    try {
        g = new BigDecimal(LCDecimalToEn_US(g))
    } catch(d) {
        g = null
    }
    if (g != null) {
        var f = this.mAllowable[h].p;
        g = new DecimalType(g, f).toString() + " " + h
    } else {
        g = h
    }
    this.SetScreenValue(g);
    if (! (this instanceof TPACurrency)) {
        this.SetDirty(this.mInputNode)
    }
};
DCurrency.prototype.IsAllowable = function(b) {
    return b in this.mAllowable
};
JFieldFactories.Currency = function(b, f, d) {
    return new JCurrency(b, f, d)
};
TPAFieldFactories.Currency = function(b, f, d) {
    return new TPACurrency(b, f, d)
};
TPACurrency.prototype.mIsComplexField = JCurrency.prototype.mIsComplexField = true;
function JCurrency(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
function TPACurrency(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
JCurrency.prototype.init = function(b, g, f) {
    JCurrency.superclass.init.call(this, b, g, f);
    if (! ("p" in this.mObj)) {
        this.mObj.p = 2
    }
    if (! ("a" in this.mObj)) {
        this.mObj.a = {};
        for (var d in getcurrencyCodes_NS(b)) {
            if (! ("d" in this.mObj)) {
                this.mObj.d = d
            }
            this.mObj.a[d] = getcurrencyCodes_NS(b)[d].p
        }
    }
};
TPACurrency.prototype.init = function(b, g, f) {
    TPACurrency.superclass.init.call(this, b, g, f);
    if (! ("p" in this.mObj)) {
        this.mObj.p = 2
    }
    if (! ("a" in this.mObj)) {
        this.mObj.a = {};
        for (var d in getcurrencyCodes_NS(b)) {
            if (! ("d" in this.mObj)) {
                this.mObj.d = d
            }
            this.mObj.a[d] = getcurrencyCodes_NS(b)[d].p
        }
    }
};
TPACurrency.prototype.SetScreenValue = JCurrency.prototype.SetScreenValue = function(b) {
    this.mInputNode.value = b;
    this.FieldValChanged()
};
TPACurrency.prototype.mHaveStoredData = JCurrency.prototype.mHaveStoredData = true;
TPACurrency.prototype.G = JCurrency.prototype.G = function() {
    var b = this.mObj.v;
    if (b.isNull) {
        return Null
    }
    if (b.type != 12) {
        b = new CurrencyType(b, this, true)
    }
    if (b.mCurCode == null || b.mCurCode == "") {
        b.mCurCode = this.mObj.d
    }
    if (! (b.mCurCode in this.mObj.a)) {
        return Null
    } else {
        this.mObj.v.mFunc = {};
        for (var d in this.mObj.f) {
            this.mObj.v.mFunc[d] = {
                p: this.mObj.f[d]
            }
        }
        b = b.CurrSetDate(b.getDate())
    }
    b.mPrecision = this.GetPrecision(b.mCurCode);
    return b
};
TPACurrency.prototype.GetDefaultCurrency = JCurrency.prototype.GetDefaultCurrency = function() {
    return this.mObj.d
};
TPACurrency.prototype.GetPrecision = JCurrency.prototype.GetPrecision = function(b) {
    if ("a" in this.mObj && b in this.mObj.a) {
        return this.mObj.a[b]
    }
    return 2
};
TPACurrency.prototype.DoSet = TPACurrency.prototype.DoSLoadEntry = JCurrency.prototype.DoSet = JCurrency.prototype.DoSLoadEntry = function(b) {
    this.mObj.v = (b.isNull) ? Null: b;
    if (! (this instanceof TPACurrency)) {
        this.SetDirty()
    }
};
TPACurrency.prototype.IsAllowable = JCurrency.prototype.IsAllowable = function(b) {
    return b in this.mObj.a
};
function Currency_Validate(g, h, d, b) {
    var f = g.mLastChanged && getField_LastCleared_NS(g.windowID) <= g.mLastChanged;
    if (!f) {
        return null
    }
    var k = h.toDecimal();
    if (d.compareTo(k) > 0 || b.compareTo(k) < 0) {
        return {
            t: 2,
            n: 9272,
            m: null,
            a: "" + d + "," + b + " : " + g.GLabelOrName()
        }
    }
    if (g.IsAllowable(h.mCurCode)) {
        return null
    }
    return {
        t: 2,
        n: 9326,
        m: null,
        a: "" + g.G().toString() + " : " + g.GLabelOrName()
    }
}
var CurrencyRatios = {};
function GetExchangeRates(f, b) {
    var d = false;
    if (f in CurrencyRatios && b in CurrencyRatios[f]) {
        var h = CurrencyRatios[f][b].expires;
        if (h > new Date().UnixTimestamp()) {
            d = true
        }
    }
    if (d) {
        return CurrencyRatios[f][b]
    } else {
        var g;
        if (getCurWFC_NS(getCurrentWindowID_NS())) {
            g = new NDXGetCurrencyExchangeRates(getCurrentWindowID_NS(), f, b).GetResult()
        } else {
            new WorkflowContext(getCurrentWindowID_NS(), {
                f: function() {
                    g = new NDXGetCurrencyExchangeRates(getCurrentWindowID_NS(), f, b).GetResult()
                }
            })
        }
        if (! (f in CurrencyRatios)) {
            CurrencyRatios[f] = {}
        }
        CurrencyRatios[f][b] = g;
        return g
    }
}
DCurrency.prototype.EqualsDefaultValue = function(b) {
    var d = this.GDefault();
    if (d == null) {
        return false
    }
    if ((! ("d" in getDefaults_NS(this.windowID)[this.mID])) && d instanceof CharType) {
        return this.mInputNode.value.trim(1 | 2) == d.toString()
    }
    return DCurrency.superclass.EqualsDefaultValue.call(this, b)
};
TPACurrency.prototype.DOMClick = DCurrency.prototype.DOMClick = function(evt) {
    DCurrency.superclass.DOMClick.call(this, evt);
    if (this.GAccess() == 3) {
        return
    }
    var e = FakeButton_Find(evt.element);
    if (e) {
        if ((this instanceof TPACurrency)) {
            this.mInputNode = e.parentNode.childNodes[2];
            var menudef = eval(this.mInputNode.getAttribute("arallowablecur"));
            this.mAllowable = {};
            if (menudef.length == 0) {
                this.mMenuDef = currencyMenu;
                this.mAllowable = currencyCodes;
                for (var i in currencyCodes) {
                    this.mDefaultCurrency = i;
                    this.mDefaultPrecision = currencyCodes[i].p;
                    break
                }
            } else {
                for (var i = 0; i < menudef.length; ++i) {
                    var label = "";
                    if (menudef[i].v in currencyCodes) {
                        label = " - " + currencyCodes[menudef[i].v].l
                    }
                    menudef[i].l = menudef[i].v + label.HTMLEncode();
                    this.mAllowable[menudef[i].v] = {
                        p: menudef[i].p,
                        l: label
                    };
                    if (menudef[i].d == "1") {
                        this.mDefaultCurrency = menudef[i].v;
                        this.mDefaultPrecision = menudef[i].p
                    }
                }
                this.mMenuDef = menudef
            }
            if (this.mMenuDef.length == 0) {
                this.mDefaultCurrency = "";
                this.mDefaultPrecision = 2
            }
            menudef = eval(this.mInputNode.getAttribute("arfunctionalcur"));
            this.mFunctional = {};
            for (var i = 0; i < menudef.length; ++i) {
                this.mFunctional[menudef[i].v] = menudef[i].p
            }
        }
        if (e.className.indexOf("menu") != -1 && this.GAccess() != 1) {
            if (!this.mMenu) {
                var menudef = this.mMenuDef;
                var uimenudef = [];
                for (var i = 0; i < menudef.length; ++i) {
                    uimenudef.push({
                        v: menudef[i].l,
                        l: menudef[i].l
                    })
                }
                this.mMenu = new CurrencyMenu(this, uimenudef);
                if (this instanceof TPACurrency) {
                    this.mMenu.mXAdjust = 3;
                    this.mMenu.mYAdjust = 3
                }
            }
            return {
                n: {
                    f: this.mMenu.Open,
                    t: this.mMenu,
                    a: [e]
                }
            }
        } else {
            if (e.className.indexOf("expand") != -1) {
                if (this instanceof TPACurrency) {
                    if (this.Validate() == null) {
                        try {
                            var val = this.FromUIInput(this.mInputNode.value, true, true);
                            if (val.isNull) {
                                val = this.G()
                            }
                            this.S(val)
                        } catch(err) {
                            return
                        }
                    }
                } else {
                    if (this.Validate() == null) {
                        this.S(this.G())
                    }
                }
                if (this instanceof TPACurrency) {
                    new CurrencyPopup(this).ShowPopup(e, 3, e.offsetHeight + 3)
                } else {
                    new CurrencyPopup(this).ShowPopup(e, 0, e.offsetHeight)
                }
            } else {
                this.mInputNode.focus()
            }
        }
    }
};
DCurrency.prototype.DOMMouseOver = function(b) {
    DCurrency.superclass.DOMMouseOver.call(this, b);
    if (this.mHasHoverEvt) {
        return
    }
    var g = b.element;
    while (g && !(g.tagName == "INPUT")) {
        g = g.offsetParent
    }
    if (g != null) {
        var h = this.mInputNode.value;
        var d = /^(.*)([A-Z][A-Z][A-Z])$/;
        if (h.match(d)) {
            var f = h.replace(d, "$2");
            if (f in this.mAllowable) {
                g.setAttribute("title", h.replace(d, "$1") + " " + this.mAllowable[f].l)
            } else {
                g.setAttribute("title", h)
            }
        } else {
            g.setAttribute("title", h)
        }
    }
};
DCurrency.prototype.DOMBlur = function(b) {
    if (this.Validate() == null) {
        var d = this.G();
        if (!d.isNull) {
            this.S(d)
        }
    }
    return DCurrency.superclass.DOMBlur.call(this, b)
};
DDiary.prototype = new DataField();
DDiary.prototype.constructor = DDiary;
DDiary.superclass = DataField.prototype;
DOMFieldFactories.Diary = function(b, f, d) {
    return new DDiary(b, f, d)
};
function DDiary(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
    getFormContext(g).DiaryFields.push(this)
}
DDiary.prototype.init = function(b, g, f) {
    this.mInputNode = f.childNodes[2];
    this.mbShowURL = (this.mInputNode.getAttribute("arshowurl") != null) ? true: false;
    DDiary.superclass.init.call(this, b, g, f);
    if (this.mbShowURL) {
        var d = this.mObj;
        d = d.firstChild;
        while (1) {
            if (d.nodeType == 1 && d.tagName == "DIV" && d.className.indexOf("text") != -1) {
                break
            }
            if (!d.nextSibling) {
                break
            }
            d = d.nextSibling
        }
        this.mDivEditBox = d;
        this.mDivEditBox.dir = "ltr";
        this.mInputNode.onblur = DChar.convert
    }
};
DDiary.prototype.ConvertPrimitiveToDataType = JDiary.prototype.ConvertPrimitiveToDataType = function(b) {
    return new CharType(b)
};
DDiary.prototype.FromUIInput = function(f, d, b) {
    if (b) {
        f = ExpandString(this.windowID, f, 2 | 4, this.mID, 10)
    }
    f = f.trim(1 | 2);
    if (f == "") {
        return Null
    }
    return new CharType(f)
};
DDiary.prototype.UpdateExpandImage = function(b) {
    var d = this.mObj.firstChild;
    while (d && (!d.childNodes[1] || d.childNodes[1].tagName != "IMG")) {
        d = d.nextSibling
    }
    if (d) {
        d = d.childNodes[1];
        if (b) {
            d.src = d.src.replace(/diary_empty/, "diary_full")
        } else {
            d.src = d.src.replace(/diary_full/, "diary_empty")
        }
    }
};
DDiary.prototype.SetHistory = function(b) {
    if (this.mHistory != b) {
        this.UpdateExpandImage(b != null);
        this.mHistory = b;
        if (this.mCharEditBox && this.mCharEditBox.mDiv) {
            CharEditBoxPopup_UpdateHistory(this.mCharEditBox, b == null ? "": b)
        }
    }
};
DDiary.prototype.DoSLoadEntry = function(b) {
    if (b.isNull) {
        this.SetHistory(null)
    }
    DDiary.superclass.DoSLoadEntry.call(this, b)
};
DDiary.prototype.ConvertDTForSLE = function(b) {
    this.mDeferred = false;
    if (b instanceof DiaryType) {
        this.SetHistory(b.toString());
        if (ARPrefsGetAsNumber(20101) != 2) {
            return CharNull
        }
        return this.G()
    }
    this.SetHistory(null);
    return this.ConvertDTForS(b)
};
DDiary.prototype.ConvertDTForS = function(b) {
    if (b.type == 4) {
        return b
    }
    return new CharType(b.toString())
};
DDiary.prototype.GDefault = function() {
    var b = DDiary.superclass.GDefault.call(this);
    this.SetHistory(null);
    return b
};
DDiary.prototype.Clear = function() {
    var b = this.mID;
    if ((b >= 1000000 && b <= 1999999) || (b >= 3000000 && b <= 3999999) || b == 1576 || b == 1575) {
        return
    }
    DDiary.superclass.Clear.call(this);
    this.SetHistory(null)
};
DDiary.prototype.mHaveStoredData = true;
DDiary.prototype.GetHistory = function() {
    if (!this.mDeferred) {
        return this.mHistory
    }
    var b = getCurWFC_NS(this.windowID).notes;
    getCurWFC_NS(this.windowID).notes = [];
    var g = new NDXGetEntry(this.windowID, this.mServer, this.mSchema, ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), window.name, this.mEntry, [this.mID], false);
    var f = g.result;
    getCurWFC_NS(this.windowID).notes = b;
    this.mHistory = "";
    if (f instanceof Array) {
        if (f.length > 0) {
            for (var d = 0; d < f.length; d++) {
                if (f[d].t) {
                    if (f[d].t == 5) {
                        this.SetHistory(f[d].v);
                        break
                    }
                }
            }
        }
    }
    this.mDeferred = false;
    return this.mHistory
};
DDiary.prototype.GTrim = JDiary.prototype.GTrim = function() {
    var d = this.G();
    if (d == CharNull || d.isNull) {
        return d
    }
    var b = d.toPrimitive();
    if (b == "") {
        return CharNull
    }
    b = b.trim(1 | 2);
    if (b == "") {
        return CharNull
    }
    return this.ConvertPrimitiveToDataType(b)
};
DDiary.prototype.mDataType = 4;
JDiary.prototype = new Field();
JDiary.prototype.constructor = JDiary;
JDiary.superclass = Field.prototype;
function JDiary(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
    getFormContext(g).DiaryFields.push(this)
}
JDiary.prototype.mHaveStoredData = true;
JDiary.prototype.G = function() {
    if (this.mDeferred) {
        var f = new NDXGetEntry(this.windowID, this.mServer, this.mSchema, ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), window.name, this.mEntry, [this.mID], false);
        var b = f.result;
        if (b instanceof Array) {
            if (b.length > 0) {
                var d = Datatype_Factory(b[0]);
                this.SLoadEntry(d)
            }
        } else {}
        this.mDeferred = false
    }
    var g = this.mObj.v;
    if (g.isNull || g.toString() == "") {
        return CharNull
    } else {
        if (g.type == 4) {
            return g
        } else {
            this.mObj.v = new CharType(g);
            return this.mObj.v
        }
    }
};
JDiary.prototype.DoSLoadEntry = function(b) {
    if (b instanceof DiaryType) {
        this.mObj.v = Null
    } else {
        this.mObj.v = b
    }
    this.mDeferred = false
};
JDiary.prototype.Clear = function() {
    this.mDeferred = false;
    JDiary.superclass.Clear.call(this)
};
JDiary.prototype.DoSet = function(d) {
    var f = {
        hasKeyword: false,
        hasTemporalKeyword: false
    };
    var b = ExpandString(this.windowID, d.toString(), 2 | 4 | 8, this.mID, this.mDataType, f);
    if (f.hasTemporalKeyword) {
        this.mObj.v = (d.isNull) ? CharNull: d
    } else {
        if ((this.mDataType == 4) && !f.hasKeyword) {
            this.mObj.v = (d.isNull) ? CharNull: d
        } else {
            this.mObj.v = new CharType(b)
        }
    }
    this.SetDirty();
    this.mDeferred = false
};
DDiary.prototype.mDeferred = JDiary.prototype.mDeferred = false;
DDiary.prototype.Defer = function(f, d, b) {
    if (this.mID in getForm_NS(this.windowID).displayOnlyFields) {
        this.mDeferred = false;
        return
    }
    if (ARPrefsGetAsNumber(20101) != 2) {
        this.S(Null)
    }
    this.mHistory = "";
    this.mServer = f;
    this.mSchema = d;
    this.mEntry = b;
    this.mDeferred = true;
    this.UpdateExpandImage(true)
};
JDiary.prototype.Defer = function(f, d, b) {
    if (this.mID in getForm_NS(this.windowID).displayOnlyFields) {
        this.mDeferred = false;
        return
    }
    this.S(Null);
    this.mServer = f;
    this.mSchema = d;
    this.mEntry = b;
    this.mDeferred = true
};
DDiary.SetDiaryFieldsDeferred = function(b, k, g, d) {
    for (var h in getFormContext(b).DiaryFields) {
        getFormContext(b).DiaryFields[h].Defer(k, g, d)
    }
};
DDiary.prototype.SetValue = function(b) {
    if (b && b.length > 0) {
        this.mInputNode.value = b;
        convertPlainToFormattedText(b, this.mDivEditBox);
        this.mDivEditBox.style.visibility = "visible";
        this.mInputNode.style.visibility = "hidden"
    } else {
        this.mInputNode.value = b;
        this.mDivEditBox.innerHTML = "";
        this.mDivEditBox.style.visibility = "hidden";
        this.mInputNode.style.visibility = "visible"
    }
    this.mPrimVal = b
};
DDiary.prototype.GetValue = function() {
    if (this.mDivEditBox && this.mDivEditBox.style.visibility == "visible") {
        return this.innerText()
    }
    return this.mInputNode.value
};
DDiary.prototype.updateInnerHTML = function(g) {
    var f = this.mDivEditBox;
    f.innerHTML = g;
    var b = f.getElementsByTagName("a");
    for (var d = 0; d < b.length; d++) {
        if (f.contentEditable == "true") {
            b[d].onmouseover = function() {
                f.contentEditable = false
            };
            b[d].onmouseout = function() {
                f.contentEditable = true
            }
        }
        b[d].target = "_blank";
        b[d].href = b[d].innerHTML
    }
    this.FieldValChanged()
};
DDiary.prototype.innerText = function() {
    return getInnerText(this.mDivEditBox)
};
DDiary.prototype.TabableElementSelector = function(b) {
    if ((b.tagName == "A" && b.className && b.className.indexOf("btn") >= 0) || b.tagName == "INPUT" || b.tagName == "TEXTAREA") {
        if (!b.style || b.style.visibility != "hidden") {
            return b
        }
    }
    return null
};
DDiary.prototype.UpdateROColour = function() {
    if (this.mbShowURL) {
        this.mInputNode.style.backgroundColor = getARFieldROBg_NS(this.windowID);
        this.mDivEditBox.style.backgroundColor = getARFieldROBg_NS(this.windowID)
    } else {
        DDiary.superclass.UpdateROColour.call(this)
    }
};
DDiary.prototype.UpdateAccess = function(f) {
    if (this.mbShowURL) {
        var d = f == 3,
        b = f == 1;
        var g = this.mObj;
        g.className = g.className.replace(SACCESSRE, "");
        if (d) {
            g.className += " dfd"
        }
        this.mDivEditBox.style.backgroundColor = (b ? getARFieldROBg_NS(this.windowID) : "");
        this.mInputNode.disabled = d;
        this.mInputNode.readOnly = b;
        this.mInputNode.style.backgroundColor = (b ? getARFieldROBg_NS(this.windowID) : "")
    } else {
        DDiary.superclass.UpdateAccess.call(this, f)
    }
};
DDiary.prototype.DOMClick = function(b) {
    DDiary.superclass.DOMClick.call(this, b);
    if (this.GAccess() == 3) {
        return
    }
    var d = FakeButton_Find(b.element);
    if (d) {
        if (d.className.indexOf("diary") != -1) {
            if (!this.mCharEditBox) {
                this.mCharEditBox = new CharEditPopup(this);
                this.mCharEditBox.SetOrigin(b);
                this.mCharEditBox.SetContents();
                this.mCharEditBox.ShowPopup(d, 0, d.offsetHeight, true)
            } else {
                this.mCharEditBox.SetFocus()
            }
        }
    }
};
DDiary.prototype.DOMKeyPress = function(b) {
    if (b.key == 13) {
        if (b.shift || (this.mInputNode.getAttribute("wrap") == "off")) {
            b.StopDefault();
            return {
                c: {
                    t: this,
                    f: DDiary.superclass.DOMKeyPress,
                    a: [b]
                }
            }
        } else {}
    }
};
DReal.prototype = new DataField();
DReal.prototype.constructor = DReal;
DReal.superclass = DataField.prototype;
JReal.prototype = new Field();
JReal.prototype.constructor = JReal;
JReal.superclass = Field.prototype;
TPAReal.prototype = new Field();
TPAReal.prototype.constructor = TPAReal;
TPAReal.superclass = Field.prototype;
DOMFieldFactories.Real = function(b, f, d) {
    return new DReal(b, f, d)
};
function DReal(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DReal.prototype.init = function(b, f, d) {
    this.mInputNode = d.childNodes[2];
    DReal.superclass.init.call(this, b, f, d)
};
DReal.prototype.mHaveStoredData = true;
DReal.prototype.mDataType = 3;
DReal.prototype.ConvertPrimitiveToDataType = function(b) {
    return this.FromUIInput(b, false, false)
};
DReal.prototype.GetQBEValue = function() {
    if (this.IsNullKeyword()) {
        return NullType.KEYWORD_NULL
    }
    var g = this.mInputNode.value;
    g = ExpandString(this.windowID, g, 2 | 4, this.mID, 3);
    g = g.trim(1 | 2);
    if (g == "") {
        return Null
    }
    var d = Field.GetQBEOperator(g);
    if (d == null) {
        var b = this.Validate();
        if (b) {
            throw (b)
        }
        return this.G()
    } else {
        var f = this.FromUIInput(g.substring(d.length).trim(1), true, false);
        return new CharType(d + f.toPrimitive())
    }
};
DReal.prototype.ConvertDTForS = DReal.prototype.ConvertDTForSLE = function(d) {
    var b = parseInt(this.mInputNode.getAttribute("arprecision"));
    if ((d.type == 3) && d.mPrecision == b) {
        return d
    }
    return new RealType(d.toReal(), b)
};
TPAReal.prototype.GDefault = DReal.prototype.GDefault = JReal.prototype.GDefault = function() {
    if ("d" in getDefaults_NS(this.windowID)[this.mID]) {
        return (new RealType(getDefaults_NS(this.windowID)[this.mID].d))
    } else {
        return (Null)
    }
};
DReal.prototype.FromUIInput = function(f, d, b) {
    if (b) {
        f = ExpandString(this.windowID, f, 2 | 4, this.mID, 3)
    }
    f = f.trim(1 | 2);
    if (f == "") {
        return Null
    }
    return new RealType(LCRealToEn_US(f, d), parseInt(this.mInputNode.getAttribute("arprecision")))
};
DReal.prototype.Validate = function() {
    var g = this.mInputNode;
    var d = g.getAttribute("armin");
    var b = g.getAttribute("armax");
    try {
        var h = this.FromUIInput(g.value, true, true);
        return Real_Validate(this, h, d, b)
    } catch(f) {
        f.a += ": " + this.GLabel();
        return f
    }
};
JFieldFactories.Real = function(b, f, d) {
    return new JReal(b, f, d)
};
function JReal(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
JReal.prototype.init = function(b, f, d) {
    JReal.superclass.init.call(this, b, f, d);
    if (! ("p" in this.mObj)) {
        this.mObj.p = 6
    }
};
TPAFieldFactories.Real = function(b, f, d) {
    return new TPAReal(b, f, d)
};
function TPAReal(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
TPAReal.prototype.init = function(b, f, d) {
    TPAReal.superclass.init.call(this, b, f, d);
    if (! ("p" in this.mObj)) {
        this.mObj.p = 6
    }
};
TPAReal.prototype.mHaveStoredData = JReal.prototype.mHaveStoredData = true;
TPAReal.prototype.G = JReal.prototype.G = function() {
    var b = this.mObj.v;
    if (b instanceof NullType) {
        return b
    } else {
        if (b.type == 3) {
            b.mPrecision = this.mObj.p;
            return b
        } else {
            this.mObj.v = new RealType(b, this.mObj.p);
            return this.mObj.v
        }
    }
};
TPAReal.prototype.DoSet = TPAReal.prototype.DoSLoadEntry = JReal.prototype.DoSet = JReal.prototype.DoSLoadEntry = function(b) {
    this.mObj.v = (b.isNull) ? Null: b;
    this.SetDirty()
};
TPAReal.prototype.Validate = JReal.prototype.Validate = function() {
    var b = this.G();
    if (b.isNull) {
        return null
    }
    return Real_Validate(this, b, this.mObj.min, this.mObj.max)
};
function Real_Validate(g, h, d, b) {
    var f = g.IsDirty();
    if (!f || h.isNull) {
        return null
    }
    h = h.toReal();
    if (h < d || h > b) {
        return {
            t: 2,
            n: 9272,
            m: null,
            a: "" + d + "," + b + " : " + g.GLabelOrName()
        }
    }
    return null
}
AsyncField.prototype = new Field();
AsyncField.prototype.constructor = AsyncField;
AsyncField.superclass = Field.prototype;
function AsyncField(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
AsyncField.prototype.init = function(f, o, k) {
    AsyncField.superclass.init.call(this, f, o, k);
    this.mAsyncMode = 0;
    this.mAsyncDirty = 0;
    this.mUIInstantiated = false;
    this.mAsyncQueue = [];
    this.SetAsync(1);
    if (k.style.visibility == "hidden" || k.style.display == "none") {
        if (! (this instanceof DPageHolder && this.mFloat == 2)) {
            this.SetAsync(1)
        }
    }
    var b = true;
    var d = null;
    d = k.parentNode;
    while (d && b) {
        if (d.nodeType == 1 && d.getAttribute("arid")) {
            b = false
        } else {
            d = d.parentNode
        }
    }
    this.mParentField = null;
    if (!b) {
        var g = d.getAttribute("arid");
        var h = F(f, g);
        if (h instanceof DPage) {
            this.mParentField = g;
            if (!h.IsVisible()) {
                this.SetAsync(1)
            }
            if (h.mState == 0) {
                this.SetAsync(1)
            }
        }
    }
    this.mAsyncDirty = (1 > this.mAsyncDirty ? 1 : this.mAsyncDirty);
    getAsyncFields_NS(f).push(this)
};
AsyncField.prototype.SetAsync = function(b) {
    if (this.mAsyncMode == 0 && b == 1) {
        this.mAsyncDirty = 0
    } else {
        if (this.mAsyncMode == 1 && b == -1) {
            this.FlushAsyncQueue()
        }
    }
    this.mAsyncMode += b
};
AsyncField.prototype.FlushAsyncQueue = function() {};
function AsyncField_IncrAsyncRef(b, h, g) {
    var f = getAsyncFields_NS(b);
    for (var d in f) {
        if (f[d].mParentField == h) {
            f[d].SetAsync(g)
        }
    }
}
function AsyncField_DecrAsyncRef(b) {
    var f = getAsyncFields_NS(b);
    for (var d in f) {
        f[d].SetAsync( - 1)
    }
}
BaseTable.prototype = new AsyncField();
BaseTable.prototype.constructor = BaseTable;
BaseTable.superclass = AsyncField.prototype;
BaseTable.prototype.mFtrObj = BaseTable.prototype.mHdrObj = BaseTable.prototype.mHdrLObj = BaseTable.prototype.mFtrLObj = BaseTable.prototype.mHdrRObj = BaseTable.prototype.mInnerObj = BaseTable.prototype.mChunkOuter = BaseTable.prototype.mFtrRObj = BaseTable.prototype.mColHdrObj = BaseTable.prototype.mDataTableObj = null;
BaseTable.prototype.mDOMField = BaseTable.prototype.mHaveVisualCharacteristics = true;
BaseTable.prototype.mDirtyColumns = false;
BTColData.prototype.mWidth = BTColData.prototype.mBarX = BTColData.prototype.mX = 0;
BTColData.prototype.mHeader = BTColData.prototype.mBar = BTColData.prototype.mColumn = BTColData.prototype.mType = null;
BTColData.prototype.mSortDir = 1;
BTColData.prototype.mPrimarySort = false;
BTColData.prototype.mVisible = true;
function BTColData(b) {
    this.mDataCol = b
}
BTColData.prototype.SetVisibility = function(d, b) {
    if (d == this.mVisible) {
        return
    }
    if (b.mFixedHeader) {
        this.mHeader.style.visibility = (d ? "inherit": "hidden");
        this.mBar.style.visibility = (d ? "inherit": "hidden")
    }
    this.mPrimarySort = false;
    this.mVisible = d
};
BaseTable.prototype.RestoreColData = function(d) {
    if (!d instanceof Array || d.length != this.mColDatas.length) {
        return
    }
    var g = {};
    for (var f in d) {
        if (! (f in this.mColDatas)) {
            return
        }
        var b = d[f];
        if (! ("dc" in b) || !(b.dc in this.mColDatas) || !("w" in b) || !("ps" in b) || !("sd" in b)) {
            return
        }
        g[this.mColDatas[f].mDataCol] = this.mColDatas[f].mVisible
    }
    for (var f in d) {
        this.mColDatas[f].mDataCol = d[f].dc;
        this.mColDatas[f].mWidth = d[f].w;
        this.mColDatas[f].mPrimarySort = d[f].ps;
        this.mColDatas[f].mSortDir = d[f].sd;
        this.mColDatas[f].mVisible = g[d[f].dc];
        this.mColDatas[f].SetLabel(this.mColInfo[f].heading);
        this.mColDatas[f].mType = this.mColFields[f].mObj.t
    }
    if (!this.mHScroll) {
        this.ScaleSizes()
    }
    this.mFirstLayout = true;
    this.ApplyData()
};
BaseTable.prototype.ResetColData = function() {
    var d = [],
    g = this.GetInitialColumnWidths();
    for (var f in this.mColDatas) {
        var b = g[f] < 5 ? 5 : g[f];
        d[f] = {
            dc: parseInt(f),
            w: b,
            ps: false,
            sd: -1
        }
    }
    this.mSortOrder = [];
    this.RestoreColData(d)
};
BaseTable.prototype.GetColData = function() {
    var d = [];
    for (var b in this.mColDatas) {
        var f = this.mColDatas[b];
        d[b] = {
            dc: f.mDataCol,
            w: f[b].mWidth,
            ps: f.mPrimarySort,
            sd: f.mSortDir
        }
    }
    return d
};
BaseTable.prototype.SColVis = function(b, f) {
    for (var d = 0; d < this.mColCnt; ++d) {
        if (this.mColDatas[d].mDataCol == b) {
            this.mColDatas[d].SetVisibility(f, this);
            this.mDirtyColumns = true;
            return
        }
    }
};
BaseTable.prototype.SColLabel = function(b, f) {
    for (var d in this.mColDatas) {
        if (this.mColDatas[d].mDataCol == b) {
            this.mColDatas[d].SetLabel(f);
            this.mDirtyColumns = true;
            return
        }
    }
};
BaseTable.prototype.ScaleSizes = function() {
    var b = 0,
    h = false,
    g = 1;
    for (var d in this.mColDatas) {
        if (this.mColDatas[d].mVisible) {
            b += this.mColDatas[d].mWidth
        }
    }
    g = this.mWidth / b;
    if (g == 1) {
        return
    }
    if (this.mWidth < (this.mColDatas.length * 5)) {
        return
    }
    for (var d in this.mColDatas) {
        if (this.mColDatas[d].mVisible) {
            var f = this.mColDatas[d];
            f.mWidth = Math.floor(f.mWidth * g)
        }
    }
};
function BaseTable(g, k, h, f, d) {
    if (arguments.length) {
        this.init(g, k, h, f, d)
    }
}
BaseTable.prototype.MakeTableTitle = function(d) {
    var b = this.GLabel();
    if (b == null) {
        b = ""
    }
    return b
};
function BaseTable_OnScroll(b) {
    var d = Field_FromElement(b.element);
    if (d) {
        d.UpdateScrollOffset()
    }
}
BaseTable.prototype.init = function(f, d, o, h, g, b) {
    BaseTable.superclass.init.call(this, f, d, o);
    this.mSelRow = g;
    this.mCurrentCol = -1;
    this.mParent = null;
    this.mFixedHeader = h;
    this.mRowsPresent = 0;
    this.mFirstLayout = true;
    this.mHScroll = b;
    this.mAccHScroll = false;
    this.mColDragInfo = null;
    this.mLastNonShiftedRowSelection = this.mLastRowSelection = -1;
    this.mPrimaryRowSelection = this.mARRowSelection = null;
    this.mRowSelections = [];
    this.mColDatas = [];
    this.mMouseUpRowSelection = -1;
    this.mMouseUpColSelection = -1;
    var p = this.GetColumnInfo();
    this.mColCnt = p.length;
    for (var k = 0; k < this.mColCnt; ++k) {
        this.mColDatas.push(new BTColData(k));
        if (this.mColFields) {
            this.mColDatas[k].mType = this.mColFields[k].mObj.t
        }
    }
};
BaseTable.prototype.getHoverEvtList = function() {
    return [16777216, 8388608, 4194304]
};
BaseTable.prototype.hoverEvtonChildren = function() {
    var f = false;
    for (var d = 0; d < this.mColFields.length; d++) {
        var b = AREventFunction(this.windowID, 16777216, this.mColFields[d].mID);
        if (b != null) {
            f = true;
            break
        }
    }
    return f
};
BaseTable.prototype.Unload = function() {};
BaseTable.prototype.MultiSelected = function() {
    for (var b in this.mLastRowSelections) {
        if (this.mLastRowSelections[b] != "SelPrimary") {
            return true
        }
    }
    return false
};
BaseTable.prototype.SecondarySelected = function(d) {
    for (var b in this.mLastRowSelections) {
        if (b == d) {
            if (this.mLastRowSelections[b] == "SelSecondary") {
                return true
            }
        }
    }
    return false
};
BaseTable.prototype.actList = function() {
    var d = new Array();
    for (var b = 0; b < arguments.length; b++) {
        d.push(arguments[b])
    }
    return d
};
BaseTable.prototype.SynchRLDetails = function() {
    if (this.mPrimaryRowSelection == null) {
        Field_Clear(this.windowID, true);
        Field_ClearChanged(this.windowID);
        formDisableStuff(this.windowID)
    } else {
        formEnableStuff(this.windowID)
    }
};
BaseTable.prototype.MapUIXToData = function(f) {
    var d = 0,
    b = 0;
    for (; b < this.mColDatas.length; ++b) {
        if (this.mColDatas[b].mVisible) {++d
        }
        if (d == f + 1) {
            break
        }
    }
    if (d != f + 1) {
        return null
    }
    return this.mColDatas[b].mDataCol
};
BaseTable.prototype.TagFromRowNo = function(b) {
    return b
};
BaseTable.prototype.RowNoFromTag = function(b) {
    return parseInt(b)
};
BaseTable.prototype.ARRowSelected = function(g, f, k, h) {};
BaseTable.prototype.ARRowCleared = function() {};
BaseTable.prototype.ARDrillDown = function(f, d) {};
BaseTable.prototype.SetPrimarySelection = function(g, f, d, p) {
    var o = this.mARRowSelection;
    var k = this.mPrimaryRowSelection;
    if (p) {
        this.ClearSelections(true)
    }
    var b = this.TagFromRowNo(g);
    this.mRowSelections[b] = true;
    this.mPrimaryRowSelection = b;
    this.mLastNonShiftedRowSelection = g;
    this.mARRowSelection = g + 1;
    this.mLastRowSelection = g;
    if (typeof DTreeView != "undefined" && this instanceof DTreeView) {
        this.mRow = g
    }
    var h = false;
    if (k == this.mPrimaryRowSelection) {
        h = true
    }
    if (h == false) {
        this.Clearoutfields()
    }
    return {
        n: {
            t: this,
            a: [f, d, o, h],
            f: this.ARRowSelected
        }
    }
};
BaseTable.prototype.ClearSelections = function(b) {
    this.mRowSelections = [];
    this.mPrimaryRowSelection = null;
    if (b) {
        this.mLastNonShiftedRowSelection = -1;
        this.mARRowSelection = 0;
        this.ARRowCleared()
    }
};
BaseTable.prototype.EORSelections = function(q, g, k) {
    var d = this.TagFromRowNo(q);
    this.mLastNonShiftedRowSelection = q;
    if (d in this.mRowSelections && !g) {
        var o = 0;
        for (var h in this.mRowSelections) {
            o++
        }
        if (k || d != this.mPrimaryRowSelection) {
            delete this.mRowSelections[d];
            o--;
            if (d == this.mPrimaryRowSelection && o > 0) {
                var f = null;
                for (var h in this.mRowSelections) {
                    f = h;
                    break
                }
                if (f != null) {
                    var p = this.RowNoFromTag(f);
                    this.mARRowSelection = p + 1;
                    return {
                        c: {
                            f: this.SetPrimarySelection,
                            t: this,
                            a: [p, true, true, false]
                        }
                    }
                }
            }
        }
        if (o == 0) {
            this.ClearSelections(true)
        }
    } else {
        this.mRowSelections[d] = true;
        var b = this.mARRowSelection;
        var o = 0;
        for (var h in this.mRowSelections) {
            o++
        }
        if (o == 1) {
            this.mARRowSelection = q + 1;
            return {
                c: {
                    f: this.SetPrimarySelection,
                    t: this,
                    a: [q, true, true, true]
                }
            }
        }
    }
};
BaseTable.prototype.FillSelections = function(f, k, d, g) {
    if (g) {
        this.ClearSelections(false)
    }
    this.mLastRowSelection = f;
    if (k >= 0) {
        var h = (f < k ? -1 : 1),
        b = false;
        while (!b) {
            this.mRowSelections[this.TagFromRowNo(k)] = true;
            k += h;
            b = (h == -1) ? k < f: k > f
        }
    } else {
        this.mLastNonShiftedRowSelection = d
    }
    if (this.mPrimaryRowSelection != null) {
        delete this.mRowSelections[this.mPrimaryRowSelection]
    }
    this.mPrimaryRowSelection = this.TagFromRowNo(d)
};
BaseTable.prototype.FillAllSelections = function() {
    if (this.GetData().length == 0) {
        return
    }
    this.mLevel = -1;
    var d = this.mARRowSelection;
    var b = [];
    b.push({
        t: this,
        f: function() {
            var f = this.mCurrentRow;
            var g = (this.mPrimaryRowSelection == null) ? true: false;
            if (g) {
                f = 0
            } else {
                this.mPrimaryRowSelection = null
            }
            this.FillSelections(this.GetData().length - 1, 0, f, true);
            if (g) {
                this.mARRowSelection = 1
            }
        }
    });
    return {
        n: b
    }
};
BaseTable.prototype.Resort = function(d, b) {
    this.ApplyData()
};
BaseTable.prototype.SetDefaultSizes = function() {
    var f = this.mColDatas,
    d = this.GetInitialColumnWidths();
    for (var b = 0; b < this.mColCnt; ++b) {
        f[b].mWidth = (d[b] < 5 ? 5 : d[b]);
        if (b == this.mColCnt - 1 && this.mHScroll && f[b].mWidth > 5 * 2) {
            f[b].mWidth -= 5
        }
    }
};
BaseTable.prototype.getTemplateForField = function(b) {
    return
};
BaseTable.prototype.getTemplateHeightForField = function(b) {
    return
};
BaseTable.prototype.getFieldIDForColumn = function(b) {
    return
};
BaseTable.prototype.hasImgRefs = function() {
    return false
};
BaseTable.prototype.hasVisImgRefs = function() {
    return false
};
BaseTable.prototype.getVisImgRefs = function(b) {
    return []
};
BaseTable.prototype.hasCellColor = function() {
    return false
};
BaseTable.prototype.getCellColor = function(f) {
    var d = [];
    for (var b = 0; b < this.mColCnt; ++b) {
        if (this.mColDatas[b].mVisible) {
            d[b] = ""
        }
    }
    return d
};
BaseTable.prototype.addRowToData = function(g) {
    var b = this.mResult.f.length;
    var o = genUniqueId(this);
    var k = {
        i: o,
        d: [],
        rc: -1
    };
    if (b > 0) {
        for (var f = 0; f < b - 1; f++) {
            k.d.push({
                v: "",
                t: 0,
                p: ""
            })
        }
        k.d.push({
            v: "&nbsp;",
            t: 0,
            p: ""
        })
    }
    var d = {},
    h = 0;
    if (g == (this.GetData().length + 1)) {
        this.mResult.idmap[o] = g - 1
    } else {
        for (f in this.mResult.idmap) {
            if (h < g - 1) {
                h++;
                d[f] = this.RowNoFromTag(f)
            } else {
                if (h == g - 1) {
                    d[o] = h;
                    d[f] = ++h;
                    h++
                } else {
                    if (h > g - 1) {
                        d[f] = h++
                    }
                }
            }
        }
        this.mResult.idmap = d
    }
    if (this.mResult.r.length == 0) {
        this.mResult.r[0] = k
    } else {
        this.mResult.r.splice(g - 1, 0, k)
    }
    this.mResult.r[g - 1].mXXXDirty = 2
};
function genUniqueId(b) {
    if (!b.mNextIdx) {
        b.mNextIdx = b.GetData().length
    }
    return "rid_" + b.mNextIdx++
}
function getImgRefStrAuto(d, h, k) {
    var f = F(d, h);
    if (f == null) {
        return ""
    }
    if (((typeof DTreeView != "undefined") && (typeof DTable != "undefined")) && (f instanceof DTable || f instanceof DTreeView)) {
        var s = f.mARRowSelection;
        if (s != null && s != 0) {
            if (f.mResult != undefined) {
                var g = f.mResult.r[s - 1];
                if (g != null && (!g.mXXXDirty || g.mXXXDirty != 3) && g.irv != undefined) {
                    var q = F(d, k);
                    if (q instanceof JColumn && q.hasImgRef()) {
                        var p = q.getImgFid();
                        var b = g.irv[p];
                        if (b == "") {
                            b = -1
                        }
                        var o = q.getImgURL(b);
                        if (o == null) {
                            o = ""
                        }
                        return o
                    }
                }
            }
        }
    }
    return ""
}
function getCellColorAuto(d, h, k) {
    var f = F(d, h);
    if (f == null) {
        return ""
    }
    if (typeof DTable != "undefined" && f instanceof DTable) {
        var s = f.mARRowSelection;
        if (s != null && s != 0) {
            if (f.mResult != undefined) {
                var g = f.mResult.r[s - 1];
                if (g != null && (!g.mXXXDirty || g.mXXXDirty != 3) && g.ccV != undefined) {
                    var q = F(d, k);
                    if (q instanceof JColumn && q.hasCellColor()) {
                        var p = q.getCColorFid();
                        var o = g.ccV[p];
                        if (o == "") {
                            o = -1
                        }
                        var b = q.getCColor(o);
                        if (b == null) {
                            b = ""
                        }
                        return b
                    }
                }
            }
        }
    }
    return ""
}
BaseTable.prototype.hasCellColor = function() {
    return false
};
BaseTable.prototype.getImgRefIds = function() {
    return new Array()
};
BaseTable.prototype.getCColorIds = function() {
    return new Array()
};
function getImgRefRootStrAuto(b, d) {
    var f = F(b, d);
    if (f == null) {
        return ""
    }
    if (typeof DTreeView != "undefined" && f instanceof DTreeView) {
        var g = f.getRootImgURL();
        if (g == null) {
            return ""
        } else {
            return g
        }
    }
    return ""
}
BaseTable.prototype.initResults = function() {
    this.mResult = {};
    this.mResult.f = new Array();
    for (var d = 0; d < this.mColFields.length; d++) {
        var f = F(this.windowID, this.mColFields[d].mID).mObj;
        this.mResult.f[d] = {};
        this.mResult.f[d].t = f.t;
        this.mResult.f[d].dt = f.dt;
        if ("e" in f) {
            this.mResult.f[d].e = new Array();
            for (var b in f.e) {
                this.mResult.f[d].e[b] = f.e[b].l
            }
        }
    }
    this.mResult.r = new Array();
    this.mResult.idmap = {};
    this.mResult.q = '{qual:""}';
    this.mResult.n = 0;
    this.mResult.start = 0
};
BaseTable.prototype.collectDirtyRows = function() {
    var s = "";
    var b = "{";
    var o = 0;
    if (this.mResult) {
        var h = this.mResult;
        var p = this.GetData().length;
        var q = h.f.length;
        for (var k = 0; k < p; k++) {
            if (h.r[k].mXXXDirty) {
                b += o > 0 ? ",": "r:[";
                b += '{i:"' + h.r[k].i + '"';
                if (h.r[k].mXXXDirty != 3) {
                    b += ",v:[";
                    for (var g = 0; g < q; g++) {
                        var d;
                        if (h.f[g].dt == 13) {
                            var f = ARDate.parseDate(h.r[k].d[g].v);
                            if (f) {
                                d = "" + f.GDays()
                            } else {
                                d = ""
                            }
                        } else {
                            if (h.f[g].dt == 7 || h.f[g].dt == 14) {
                                var f = ARDate.parseDateTime(h.r[k].d[g].v);
                                if (f) {
                                    d = "" + ARDate.parseDateTime(h.r[k].d[g].v).GTimestamp()
                                } else {
                                    d = ""
                                }
                            } else {
                                d = "" + h.r[k].d[g].v
                            }
                        }
                        b += (d == "&nbsp;" || d.length == 0) ? '""': '"' + d + '"';
                        if (g != q - 1) {
                            b += ","
                        }
                    }
                    b += "]"
                }
                b += "}";
                o++
            }
        }
    }
    if (o > 0) {
        b += "]";
        b += ",t:" + this.mID;
        b += ',s:"' + ExpandServerName(this.windowID, this.mObj.getAttribute("arserver")) + '"';
        b += ',ts:"' + ExpandSchemaName(this.windowID, this.mObj.getAttribute("arschema")) + '"';
        b += ', cs:"' + ARKWGetStringByIdx(this.windowID, 6) + '"';
        b += ',vu:"' + ARKWGetStringByIdx(this.windowID, 17) + '"'
    }
    b += "}";
    if (b.length > 2) {
        return b
    } else {
        return null
    }
};
BaseTable.prototype.clearDeleted = function() {
    var k = this.mResult.r;
    var b = k.length;
    var o = [],
    f = {},
    d = 0;
    for (var g = 0; g < b; g++) {
        var h = k[g];
        if (h.mXXXDirty && h.mXXXDirty == 3) {
            if (h.i in this.mRowSelections) {
                delete this.mRowSelections[h.i];
                if (this.mPrimaryRowSelection == h.i) {
                    this.mPrimaryRowSelection = null;
                    this.mARRowSelection = 0;
                    this.mCurrentRow = -1
                }
            }
        } else {
            o.push(h);
            f[h.i] = d++
        }
    }
    if (this.mPrimaryRowSelection == null) {
        for (var d in this.mRowSelections) {
            this.mPrimaryRowSelection = d;
            break
        }
    }
    if (this.mPrimaryRowSelection != null) {
        this.mCurrentRow = f[this.mPrimaryRowSelection];
        this.mARRowSelection = this.mCurrentRow + 1
    }
    this.mResult.r = o;
    this.mResult.idmap = f
};
BaseTable.prototype.Clearoutfields = function() {
    return
};
BTColData.prototype.SetLabel = function(b) {
    if (this.mHeader && this.mHeader.firstChild) {
        this.mHeader.firstChild.data = b
    }
};
function BaseTable_DragHandler(f) {
    var d = f.srcElement.getAttribute("artableid");
    var b = f.srcElement.getAttribute("arwindowid");
    getFields_NS(b)[d].DragHandler(f)
}
BaseTable.prototype.DOMMouseOver = function(b) {
    if (window.hoverState) {
        hoverState.eventMouseOver(b)
    }
    if (this.mHasHoverEvt) {
        return
    }
    var d = b.element;
    while (d && !(d.tagName == "TD" || d.tagName == "DIV")) {
        d = d.offsetParent
    }
    if (d != null && (d.className.indexOf("BaseTableCell") != -1 || d.className.indexOf("BaseTableHeader") != -1)) {
        if (d.parentNode.className.indexOf("SelPrimary") == -1 && d.parentNode.className.indexOf("SelSecondary") == -1) {
            d.parentNode.className += " Rollover"
        } else {
            if (d.parentNode.className.indexOf("SelPrimary") != -1) {
                d.parentNode.className += " SelPrimaryRollover"
            } else {
                if (d.parentNode.className.indexOf("SelSecondary") != -1) {
                    d.parentNode.className += " SelSecondaryRollover"
                }
            }
        }
        if (!d.getAttribute("title")) {
            if (d.firstChild.nodeType == 1 && d.firstChild.firstChild && d.firstChild.firstChild.nodeType == 3) {
                d.setAttribute("title", d.firstChild.firstChild.data)
            } else {
                if (d.firstChild.nodeType == 3) {
                    d.setAttribute("title", d.firstChild.data)
                }
            }
        }
    }
};
BaseTable.prototype.DOMMouseMove = function(b) {
    if (window.hoverState) {
        hoverState.eventMouseOver(b)
    }
};
BaseTable.prototype.DOMMouseOut = function(b) {
    if (window.hoverState) {
        hoverState.eventMouseOut(b)
    }
    var d = b.element;
    while (d && !(d.tagName == "TD" || d.tagName == "DIV")) {
        d = d.offsetParent
    }
    if (d != null && (d.className.indexOf("BaseTableCell") != -1 || d.className.indexOf("BaseTableHeader") != -1)) {
        if (d.parentNode.className.indexOf("SelPrimaryRollover") != -1) {
            d.parentNode.className = d.parentNode.className.replace(/SelPrimaryRollover/g, "")
        } else {
            if (d.parentNode.className.indexOf("SelSecondaryRollover") != -1) {
                d.parentNode.className = d.parentNode.className.replace(/SelSecondaryRollover/g, "")
            } else {
                if (d.parentNode.className.indexOf("Rollover") != -1) {
                    d.parentNode.className = d.parentNode.className.replace(/Rollover/g, "")
                }
            }
        }
        d.parentNode.className = d.parentNode.className.replace(/\s+$/g, "")
    }
};
BaseTable.prototype.DOMMouseUp = function(b) {
    var d = this.MapUIXY(b.element);
    if (d) {
        this.mMouseUpRowSelection = d.y;
        this.mMouseUpColSelection = d.x
    } else {
        this.mMouseUpRowSelection = -1;
        this.mMouseUpColSelection = -1
    }
};
BaseTable.prototype.SyncCaret = function(b, d) {
    if (b.className != "BaseTableInlineEdit" || this.mCurrentCol == -1) {
        return
    }
    var g = this.FishOutTR(d);
    if (g != null) {
        var f = g.childNodes[this.mCurrentCol].lastChild;
        f.focus()
    }
};
BaseTable.prototype.DOMKeyDown = function(d) {
    if (this.mRowsPresent == 0) {
        return
    }
    if (d.key == 13) {
        if (this.mPrimaryRowSelection == null) {
            return
        }
        d.StopDefault();
        return this.ARDrillDown({
            x: 0,
            y: this.RowNoFromTag(this.mPrimaryRowSelection)
        },
        false)
    } else {
        if ((d.key == 38 || d.key == 40) && this.mSelRow != 1) {
            d.StopDefault();
            var f = (d.key == 38 ? -1 : 1);
            var g;
            if (this.mPrimaryRowSelection == null) {
                g = 0
            } else {
                g = this.calRowSel(f)
            }
            g = (g < 0 ? 0 : g);
            g = (g >= this.mRowsPresent ? this.mRowsPresent - 1 : g);
            var b = [];
            if (d.shift && this.mSelRow == 0) {
                return {
                    c: {
                        f: this.FillSelections,
                        t: this,
                        a: [g, this.mLastNonShiftedRowSelection, this.mLastNonShiftedRowSelection < 0 ? 0 : this.mLastNonShiftedRowSelection, true]
                    },
                    n: {
                        t: this,
                        f: this.ApplySelections,
                        a: [true, false]
                    }
                }
            } else {
                b.push({
                    f: function() {
                        this.SyncCaret(d.element, g)
                    },
                    t: this
                });
                b.push({
                    t: this,
                    f: this.ApplySelections,
                    a: [true, false]
                });
                b.push({
                    f: this.SetPrimarySelection,
                    t: this,
                    a: [g, true, true, true]
                });
                b.push({
                    f: function() {
                        this.mLastRowSelection = g;
                        this.mLastNonShiftedRowSelection = g
                    },
                    t: this
                });
                return {
                    n: b
                }
            }
        } else {
            if ((d.key == 65 && d.ctrl) && this.mSelRow != 1) {
                d.StopDefault();
                return {
                    c: {
                        f: this.FillAllSelections,
                        t: this
                    },
                    n: {
                        f: this.ApplySelections,
                        a: [true, false],
                        t: this
                    }
                }
            }
        }
    }
};
BaseTable.prototype.DragHandler = function(A) {
    var B = A.srcElement;
    var o = A.mx + this.mScrollLeft;
    if (B.className.indexOf("BaseTableBar") != -1) {
        var b = (B.getAttribute("arselbar") != null) ? true: false;
        var h = parseInt(B.getAttribute("arcolumnid"));
        if (!b) {}
        var g = (b) ? this.mAccmX: this.mColDatas[h].mX;
        var v = (b) ? this.mAccmWidth: this.mColDatas[h].mWidth;
        if (A.state == 0) {
            var u = (g + 5) - this.mScrollLeft;
            A.dragContext.SetDragBounds(u, null, u + (v - 11), null)
        } else {
            if (A.original || (!A.original && A.state == 2)) {
                var p = (b) ? this.mAccmWidth + o - this.mAccBarWidth: this.mColDatas[h].mWidth + o - this.mColDatas[h].mBarX;
                if (p < 5) {
                    p = 5
                }
                if (b) {
                    this.mAccmWidth = p
                } else {
                    this.mColDatas[h].mWidth = p
                }
                this.ApplySizes();
                this.UpdateScrollOffset()
            }
        }
    } else {
        var h = null;
        if (A.state == 0) {
            for (var w = 0; w < this.mColDatas.length && h == null; ++w) {
                if (o >= this.mColDatas[w].mX && o < (this.mColDatas[w].mX + this.mColDatas[w].mWidth) && this.mColDatas[w].mVisible) {
                    h = w
                }
            }
            this.mColDragInfo = {
                mLeft: -1,
                mRight: -1,
                mOrigCol: h,
                mCol: h
            };
            this.SetColHeaderStyles(false)
        } else {
            if (A.state == 1) {
                var D = 999999999,
                k = null;
                for (var w = 0; w < this.mColDatas.length; ++w) {
                    if (this.mColDatas[w].mVisible) {
                        var s = Math.abs(o - this.mColDatas[w].mX);
                        if (s < D) {
                            D = s;
                            h = w
                        }
                        k = w
                    }
                }
                if (k != null) {
                    var s = Math.abs(o - (this.mColDatas[k].mX + this.mColDatas[k].mWidth));
                    if (s < D) {
                        D = s;
                        h = k + 1;
                        for (var w = h; w < this.mColCnt; w++) {
                            h += 1
                        }
                    }
                }
                var C = h - 1,
                f = h;
                while (C in this.mColDatas && !this.mColDatas[C].mVisible) {--C
                }
                this.SetColHeaderStyles(true);
                this.mColDragInfo.mLeft = f;
                this.mColDragInfo.mRight = C;
                this.mColDragInfo.mCol = h;
                this.SetColHeaderStyles(false)
            } else {
                this.SetColHeaderStyles(true);
                if (A.state == 2) {
                    var d = this.mColDragInfo.mOrigCol,
                    y = this.mColDragInfo.mCol;
                    var q = [];
                    for (var w = 0; w < this.mColCnt; ++w) {
                        if (w == y) {
                            q.push(this.mColDatas[d])
                        }
                        if (w != d) {
                            q.push(this.mColDatas[w])
                        }
                    }
                    if (q.length == this.mColCnt - 1) {
                        q.push(this.mColDatas[d])
                    }
                    this.mColDatas = q;
                    this.mDirtyColumns = true;
                    this.ApplyData()
                }
                this.mColDragInfo = null
            }
        }
    }
};
BaseTable.prototype.SetColHeaderStyles = function(b) {
    var d = this.mColDragInfo.mLeft,
    f = this.mColDragInfo.mRight;
    if (d in this.mColDatas && this.mColDatas[d].mHeader) {
        this.mColDatas[d].mHeader.className = b ? "BaseTableHeader": "BaseTableHeaderDragL"
    }
    if (f in this.mColDatas && this.mColDatas[f].mHeader) {
        this.mColDatas[f].mHeader.className = b ? "BaseTableHeader": "BaseTableHeaderDragR"
    }
};
BaseTable.prototype.Resize = function(h, d) {
    this.mObj.style.height = d;
    if (this.mHdrObj != null && this.mFtrObj != null) {
        var o = this.mHdrObj.offsetHeight,
        k = this.mFtrObj.offsetHeight;
        var f = d - o - k;
        if (!this.mHdrLObj.firstChild && !this.mHdrRObj.firstChild && this.mChunkOuter == null && !this.mObj.getAttribute("arentretstr") && !this.mObj.getAttribute("arnotrefstr")) {
            this.mHdrObj.style.visibility = "hidden";
            this.mInnerObj.style.top = 0;
            f += o
        }
        this.mFtrObj.style.top = d - k;
        if (!this.mFtrLObj.firstChild && !this.mFtrRObj.firstChild) {
            this.mFtrObj.style.visibility = "hidden";
            f += k
        }
        if (f < 0) {
            f = 0
        }
        this.mInnerObj.style.height = f;
        this.mObj.style.width = h;
        if (h < 0) {
            h = 0
        }
        this.mInnerObj.style.width = h;
        this.mFtrObj.style.width = this.mHdrObj.style.width = h;
        this.mHdrObj.firstChild.style.width = this.mFtrObj.firstChild.style.width = h;
        d = f
    }
    this.mHeight = d;
    this.mOuter.style.height = this.mHeight;
    if (this.mFixedHeader) {
        var f = this.mHeight - 16;
        this.mInner.style.height = (f < 0 ? 0 : f)
    } else {
        this.mInner.style.height = this.mHeight
    }
    this.mWidth = h;
    this.mOuter.style.width = this.mInner.style.width = this.mWidth;
    if (this.mColHdrObj != null) {
        var b = 0;
        for (var g = 0; g < this.mColCnt; ++g) {
            if (this.mColDatas[g].mVisible) {
                b += this.mColDatas[g].mWidth
            }
        }
        this.mColHdrObj.style.width = (this.mWidth > b ? this.mWidth: b);
        this.UpdateScrollOffset()
    }
    if (!this.mHScroll) {
        this.ScaleSizes()
    }
    this.ApplySizes()
};
BaseTable.prototype.UpdateScrollOffset = function() {
    this.mScrollLeft = this.mInner.scrollLeft;
    if (this.mFixedHeader) {
        this.mColHdrObj.style.left = -this.mScrollLeft
    }
};
BaseTable.prototype.InstantiateUI = function(d) {
    this.mParent = d;
    var b = [];
    b.push("<DIV class='BaseTableOuter' draghandler='BaseTable_DragHandler'>");
    if (this.mFixedHeader) {
        this.BuildColumnHeaders(b)
    }
    b.push("<DIV class='BaseTableInner'></DIV></DIV>");
    this.mScrollLeft = 0;
    this.mParent.innerHTML = b.join("");
    this.mOuter = this.mParent.firstChild;
    if (this.mFixedHeader) {
        this.RefreshHeaderRefs();
        this.mInner = this.mOuter.childNodes[1]
    } else {
        this.mInner = this.mOuter.firstChild
    }
    if (this.mFixedHeader) {
        this.mInner.style.top = 16
    }
    this.mInner.onscroll = FormEvent.Trampoline(BaseTable_OnScroll)
};
BaseTable.prototype.DOMClickActionBase = function(b, h) {
    if (this.GAccess() == 3) {
        return this.actList(0)
    }
    var f = b.element;
    while (f.nodeType != 1 || (f.tagName != "DIV" && f.tagName != "TR")) {
        f = f.parentNode
    }
    if (h) {
        if (f.className == "BaseTableHeader") {
            return this.actList(1)
        }
    }
    var g = b.element;
    var d = false;
    if (h) {
        if (g.tagName == "INPUT" && g.className.indexOf("btn") != -1) {
            d = true
        }
        if (g.tagName == "INPUT" && g.type == "checkbox" && g.className != "colcheck") {
            return this.actList(3)
        }
    }
    if (g.tagName == "INPUT" && g.type == "checkbox" && g.className != "colcheck") {
        return this.actList(2)
    }
    var k = this.MapUIX(b.element);
    if (k == null) {
        return this.actList(0)
    }
    if (f.tagName == "TR") {
        if (b.shift && (b.ctrl || b.meta)) {
            return this.actList(0)
        }
        if (!b.ctrl && !b.shift && !b.meta) {
            if (this.mSelRow == 1) {
                return this.actList(0)
            } else {
                if (h && d) {
                    return this.actList(2)
                } else {
                    if (h && b.element.tagName == "INPUT" && b.element.className == "colcheck") {
                        return this.actList(4)
                    } else {
                        if (!h) {
                            if (b.element.tagName == "INPUT" && b.element.className == "colcheck") {
                                return this.actList(0)
                            }
                            if (this.mPrimaryRowSelection == null) {
                                return this.actList(3)
                            }
                            if (k == this.RowNoFromTag(this.mPrimaryRowSelection) && !this.MultiSelected()) {
                                return this.actList(0)
                            }
                            if (this.mRowSelections[this.mResult.r[this.mMouseDownRowSelection].i] == true) {
                                return this.actList(0)
                            }
                            return this.actList(3)
                        }
                    }
                }
                if (this.mPrimaryRowSelection == null || k != this.RowNoFromTag(this.mPrimaryRowSelection)) {
                    if (h && d) {
                        return this.actList(2)
                    } else {
                        if (!h) {
                            return this.actList(3)
                        }
                    }
                } else {
                    if (h && d) {
                        return this.actList(2)
                    } else {
                        if (!h) {
                            return this.actList(4)
                        }
                    }
                }
            }
        }
        if (h && (b.ctrl || b.meta)) {
            if (this.mSelRow == 1 || this.mSelRow == 2) {
                return this.actList(0)
            } else {
                return this.actList(4)
            }
        } else {
            if (!h && b.shift) {
                if (this.mSelRow == 1 || this.mSelRow == 2) {
                    return this.actList(0)
                } else {
                    return this.actList(5)
                }
            } else {
                if (h && b.shift && b.element.tagName == "INPUT" && b.element.className == "colcheck") {
                    if (this.mSelRow == 1 || this.mSelRow == 2) {
                        return this.actList(0)
                    } else {
                        return this.actList(5)
                    }
                }
            }
        }
    }
    if (h && !b.shift && k != this.RowNoFromTag(this.mPrimaryRowSelection)) {
        return this.actList(3)
    }
    return this.actList(0)
};
BaseTable.prototype.getSortColumn = function(f) {
    var b = f;
    while (b.nodeType != 1 || (b.tagName != "DIV" && b.tagName != "TR")) {
        b = b.parentNode
    }
    var d = -1;
    if (b.className == "BaseTableHeader") {
        d = b.getAttribute("ardatacol");
        if (d != null) {
            d = parseInt(d)
        }
    }
    if (typeof d == "number") {
        return d
    }
    return - 1
};
BaseTable.prototype.DOMDragStart = function(b) {
    if (b.ctrl) {
        if (this.mSelRow == 1 || this.mSelRow == 2) {
            return {}
        } else {
            return this.DOMActionProcessor(b, this.actList(8))
        }
    }
};
BaseTable.prototype.DOMActionProcessor = function(g, b) {
    if (window.hoverState) {
        hoverState.clearTracking()
    }
    var B = g.element;
    var d = null;
    var s = [];
    for (var w = 0; w < b.length; w++) {
        switch (b[w]) {
        case 1:
            var h = this.getSortColumn(B);
            if (h != -1) {
                var D;
                for (var w in this.mColDatas) {
                    var q = this.mColDatas[w];
                    if (q.mDataCol == h) {
                        if (this.mColInfo[h].lcl == true || ("dLen" in this.mColInfo[h] && (this.mColInfo[h].dLen == 0 || this.mColInfo[h].dLen > 255))) {
                            return
                        }
                        D = q;
                        if (!q.mPrimarySort) {
                            q.mPrimarySort = true
                        } else {
                            q.mSortDir = -q.mSortDir
                        }
                    } else {
                        q.mPrimarySort = false
                    }
                }
                s.push({
                    f: function() {
                        return this.Resort(D.mDataCol, D.mSortDir)
                    },
                    t: this
                })
            }
            break;
        case 2:
            if (d == null) {
                d = this.MapUIXY(g.element)
            }
            if (d == null) {
                return
            }
            var o = this.getFieldIDForColumn(d.x);
            if (o) {
                s.push({
                    f: ExecuteWorkflow,
                    a: [this.windowID, 1, o]
                })
            }
            break;
        case 3:
        case 6:
            if (d == null) {
                d = this.MapUIXY(g.element)
            }
            if (d == null) {
                return
            }
            var k = d.y;
            this.mCurrentCol = d.x;
            if (this.mID == 1020) {
                s.push({
                    t: this,
                    f: this.SynchRLDetails,
                    a: []
                })
            }
            s.push({
                t: this,
                f: this.ApplySelections,
                a: [true, false]
            });
            s.push({
                f: this.SetPrimarySelection,
                t: this,
                a: [k, true, true, true]
            });
            s.push({
                f: function() {
                    this.mLastRowSelection = k;
                    this.mLastNonShiftedRowSelection = k
                },
                t: this
            });
            break;
        case 4:
        case 8:
            if (d == null) {
                d = this.MapUIXY(g.element)
            }
            if (d == null) {
                return
            }
            var k = d.y;
            this.mCurrentCol = d.x;
            var v = false;
            if (this.mID == 1020) {
                s.push({
                    t: this,
                    f: this.SynchRLDetails,
                    a: []
                })
            }
            var C = false;
            if (b[w] != 4) {
                C = true
            }
            var A = false;
            if (g.element.tagName == "INPUT" && g.element.className == "colcheck") {
                A = true;
                if (g.element.checked == true) {
                    var u = 0;
                    for (var w in this.mLastRowSelections) {
                        u++;
                        if (w == k) {
                            C = true
                        }
                    }
                    if (u == 1 && k + 1 == this.mARRowSelection) {
                        break
                    }
                }
            }
            s.push({
                t: this,
                f: this.ApplySelections,
                a: [v, true]
            });
            s.push({
                f: function() {
                    this.mLastRowSelection = k
                },
                t: this
            });
            s.push({
                f: this.EORSelections,
                t: this,
                a: [k, C, A]
            });
            break;
        case 5:
            if (d == null) {
                d = this.MapUIXY(g.element)
            }
            if (d == null) {
                return
            }
            var k = d.y;
            this.mCurrentCol = d.x;
            var v = false;
            var p = k;
            var f = (this.mPrimaryRowSelection != null) ? this.RowNoFromTag(this.mPrimaryRowSelection) : -1;
            var y = (this.mPrimaryRowSelection != null) ? this.RowNoFromTag(this.mPrimaryRowSelection) : k;
            s.push({
                t: this,
                f: this.ApplySelections,
                a: [v, false]
            });
            s.push({
                f: function() {
                    this.mLastRowSelection = k
                },
                t: this
            });
            s.push({
                f: this.FillSelections,
                t: this,
                a: [p, f, y, true]
            });
            break;
        case 7:
            if (d == null) {
                d = this.MapUIXY(g.element)
            }
            if (d == null) {
                return
            }
            s.push({
                f: function() {
                    return this.ARDrillDown(d, false)
                },
                t: this
            });
            break
        }
    }
    return {
        n: s
    }
};
BaseTable.prototype.DOMMouseDown = function(b) {
    var d = this.MapUIXY(b.element);
    if (d) {
        this.mMouseDownRowSelection = d.y
    } else {
        this.mMouseDownRowSelection = -1
    }
    var f = this.DOMClickActionBase(b, false);
    return this.DOMActionProcessor(b, f)
};
BaseTable.prototype.DOMClick = function(b, d) {
    var d = this.DOMClickActionBase(b, true);
    return this.DOMActionProcessor(b, d)
};
BaseTable.prototype.DOMDoubleClick = function(b) {
    var d = this.MapUIXY(b.element);
    if (d == null) {
        return
    }
    return this.ARDrillDown(d, false)
};
BaseTable.prototype.GetFocusElementForEvent = function(b) {
    var d = b.element;
    if (this.GetNestedFocusability()) {
        if ((d.tagName == "A") || (d.tagName == "INPUT") || (d.tagName == "IMG")) {
            return d
        } else {
            while (d && (d.nodeType != 1 || (d.tagName != "DIV" && d.tagName != "TR"))) {
                d = d.parentNode
            }
            if (d && ((d.className == "BaseTableColHeaders" || d.className == "BaseTableBar" || d.className == "BaseTableHeader") || (d.getAttribute("arrow") != null))) {
                return b.element
            }
        }
        return this.GetFocusElement()
    }
};
BaseTable.prototype.GetFocusElement = function() {
    var d = (this.mPrimaryRowSelection == null) ? 0 : this.RowNoFromTag(this.mPrimaryRowSelection);
    var b = this.FishOutTR(d);
    if (b == null) {
        if (this.mOuter != null) {
            return this.mOuter
        }
        return this.mObj
    }
    return b
};
BaseTable.prototype.TabableElementSelector = function(f) {
    if (f.tagName == "A") {
        var d = FakeButton_Find(f);
        if (d != null) {
            return FakeButton_TabableElementSelector(d)
        } else {
            return null
        }
    }
    if (f.tagName == "INPUT") {
        var b = f.parentNode;
        while (b.tagName != "TR" && b) {
            b = b.parentNode
        }
        if (b && b == this.GetFocusElement()) {
            return f
        }
    } else {
        if ((f.tagName == "TR") && (this.GetFocusElement() == f)) {
            return f
        } else {
            if (f.tagName == "TABLE" && f.className && f.className == "BaseTable") {
                return f
            }
        }
    }
    return null
};
BaseTable.prototype.MapUIX = function(d) {
    var f, b = 0,
    g = null;
    while (d && d.tagName != "TR") {
        if (d.tagName == "TD") {
            g = d
        }
        d = d.parentNode
    }
    if (d && d.getAttribute("arrow") != null && g != null) {
        f = parseInt(d.getAttribute("arrow"))
    } else {
        return null
    }
    if (f >= this.mRowsPresent) {
        return null
    } else {
        return f
    }
};
BaseTable.prototype.MapUIXY = function(d) {
    var f, b = 0,
    g = null;
    while (d && d.tagName != "TR") {
        if (d.tagName == "TD") {
            g = d
        }
        d = d.parentNode
    }
    if (d && d.getAttribute("arrow") != null && g != null) {
        f = parseInt(d.getAttribute("arrow"))
    } else {
        return null
    }
    if (f >= this.mRowsPresent) {
        return null
    }
    while (g.previousSibling) {
        g = g.previousSibling; ++b
    }
    if (this.colCheck == 1) {
        b -= 1
    }
    if (b >= this.mColCnt) {
        return null
    }
    return {
        y: f,
        x: b
    }
};
BaseTable.prototype.FishOutTR = function(h) {
    if (h < 0 || h >= this.mRowsPresent || this.mDataTableObj == null) {
        return null
    }
    if (this.mDataTableObj.lastChild == null) {
        return null
    }
    var d = this.mDataTableObj.lastChild;
    if (!this.mGroup) {
        return d.childNodes[h + ((this.mHiddenColHdrPresent) ? 1 : 0)]
    } else {
        for (var b = 0; b < d.childNodes.length; b++) {
            var g = d.childNodes[b];
            if (g && g.getAttribute("arrow") != null) {
                var f = parseInt(g.getAttribute("arrow"));
                if (f == h) {
                    return g
                }
            }
        }
        return null
    }
};
BaseTable.prototype.ApplySelections = function(o, V) {
    var u = this.FishOutTR(0),
    Q = {};
    var v = 0;
    if (u != null) {
        var h = -1;
        for (var R in this.mRowSelections) {
            if (!this.mResult.r[this.RowNoFromTag(R)].mXXXDirty || this.mResult.r[this.RowNoFromTag(R)].mXXXDirty != 3) {
                Q[this.RowNoFromTag(R)] = "SelSecondary";
                v++
            }
        }
        if (this.mPrimaryRowSelection != null) {
            h = this.RowNoFromTag(this.mPrimaryRowSelection);
            if (!this.mResult.r[h].mXXXDirty || this.mResult.r[h].mXXXDirty != 3) {
                Q[h] = "SelPrimary"
            }
        }
        var K = {},
        B = 0;
        for (var R in this.mLastRowSelections) {
            if (! (R in Q)) {
                K[R] = ""; ++B
            }
        }
        for (var R in Q) {
            if (Q[R] != this.mLastRowSelections[R]) {
                K[R] = Q[R]; ++B
            }
        }
        var C;
        if (B > 1750) {
            for (var U = 0; u; u = u.nextSibling, ++U) {
                if (U in K) {
                    u.className = K[U]
                } else {
                    u.className = ""
                }
            }
        } else {
            var X = u.parentNode,
            q = this.mHiddenColHdrPresent ? 1 : 0;
            for (var P = q; P < X.childNodes.length; P++) {
                var b = X.childNodes[parseInt(P)];
                var w = b.getAttribute("arrow");
                if (w == null) {
                    continue
                }
                if (typeof K[w] != "undefined") {
                    if (this.mGroup) {
                        var d = b.className;
                        d = d.replace(/SelPrimary/g, "");
                        d = d.replace(/SelSecondary/g, "");
                        d = d.replace(/Rollover/g, "");
                        d = d.replace(/\s+$/g, "");
                        d = d + " " + K[w];
                        b.className = d
                    } else {
                        var s = K[w];
                        b.className = s;
                        if (this.colCheck == 1 && s.length == 0) {
                            b.firstChild.firstChild.checked = false
                        }
                    }
                    var g = b.getElementsByTagName("TD");
                    for (var O = 0; O < g.length; O++) {
                        if (g[O].className.indexOf("editT") != -1) {
                            var N = g[O].getElementsByTagName("NOBR");
                            if (b.className == "SelPrimary") {
                                var y = document.createElement("A");
                                y.className = "btn btn3d DropMenu TableBtn";
                                y.style.display = "inline";
                                y.innerHTML = '<img id="tmenu"class="btnimg" alt="" src="' + RelContextPath + 'resources/images/field_menu.gif">';
                                N[0].appendChild(y);
                                g[O].style.border = "1px solid #728793"
                            } else {
                                if (b.className == "") {
                                    var f = N[0].getElementsByTagName("A");
                                    if (f[0] != null) {
                                        N[0].removeChild(f[0])
                                    }
                                    g[O].style.border = "none"
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (!V) {
        var E = 0;
        if (this.colCheck == 1) {
            for (var L in this.mLastRowSelections) {
                b = X.childNodes[parseInt(L) + 1];
                b.firstChild.firstChild.checked = false;
                E++
            }
        }
    }
    this.mLastRowSelections = Q;
    if (this.colCheck == 1) {
        var A = 0;
        for (var L in this.mLastRowSelections) {
            A++
        }
        if (A > 1) {
            for (var L in this.mLastRowSelections) {
                b = X.childNodes[parseInt(L) + 1];
                b.firstChild.firstChild.checked = true
            }
            if (A == this.mRowsPresent) {
                this.mColHdrObj.firstChild.firstChild.checked = true
            } else {
                this.mColHdrObj.firstChild.firstChild.checked = false
            }
        }
        if (A == 1) {
            this.mColHdrObj.firstChild.firstChild.checked = false
        }
    }
    if (o && h >= 0 && this.mObj.style.display != "none") {
        var b = this.FishOutTR(h);
        if (b != null) {
            var p = b.offsetHeight,
            I = 0,
            H = this.mInner.clientHeight;
            var g = b.getElementsByTagName("TD");
            for (R = 0; R < g.length; R++) {
                if (g[R].className.indexOf("editT") != -1) {
                    var N = g[R].getElementsByTagName("NOBR");
                    var y = N[0].getElementsByTagName("A");
                    if (typeof y == "undefined") {
                        var S = document.createElement("A");
                        S.className = "btn btn3d DropMenu TableBtn";
                        S.style.display = "inline";
                        S.innerHTML = '<img id="tmenu"class="btnimg" alt="" src="' + RelContextPath + 'resources/images/field_menu.gif">';
                        N[0].appendChild(S)
                    }
                    g[R].style.border = "1px solid #728793"
                }
            }
            while (b != this.mInner) {
                I += b.offsetTop;
                b = b.parentNode
            }
            if (I < this.mInner.scrollTop) {
                this.mInner.scrollTop = I
            } else {
                var J = this.mInner.scrollTop + H,
                G = I + p;
                if (G >= J) {
                    this.mInner.scrollTop = G - H
                }
            }
        }
    }
    if (this.mID == 1020 && this.mFtrRObj) {
        if (v == 1) {
            var D = getLocalizedMessage("{0} row selected", [v])
        } else {
            var D = getLocalizedMessage("{0} rows selected", [v])
        }
        if (this.mPrimaryRowSelection) {
            var W = getLocalizedMessage("Number {0} of {1}", [this.mARRowSelection, this.mRowsPresent]);
            D = W + "  |  " + D
        }
        NodeWrite(this.mFtrRObj, D)
    }
};
BaseTable.prototype.BuildColumnHeaders = function(o) {
    var p = this.GetColumnInfo();
    o.push("<DIV class='BaseTableColHeaders'>");
    var b = "<DIV class='BaseTableHeader' draggable=1 arwindowid='" + this.windowID + "' artableid=",
    q = " ardatacol=",
    k = ">",
    d = "</DIV>";
    var u = "<DIV class='BaseTableBar' draggable=1 dragHandler='BaseTable_DragHandler' arwindowid='" + this.windowID + "' artableid=",
    g = " arcolumnid=",
    v = "><DIV></DIV></DIV>";
    if (this.colCheck == 1) {
        var f = "<DIV class='BaseTableHeader' arselbar=1 arwindowid='" + this.windowID + "' artableid=";
        o.push(f);
        o.push(this.mID);
        o.push(k);
        o.push("<input type='checkbox' class='checkboxheader' style='height:12px;width:12px;margin:0px;'/>");
        o.push(d)
    }
    for (var h = 0; h < this.mColCnt; ++h) {
        if (this.mColDatas[h].mVisible) {
            o.push(b);
            o.push(this.mID);
            o.push(q);
            o.push(this.mColDatas[h].mDataCol);
            o.push(k);
            o.push(p[this.mColDatas[h].mDataCol].heading);
            o.push(d)
        }
    }
    if (this.colCheck == 1) {
        var s = "<DIV class='BaseTableBar' arselbar=0 artableid=";
        o.push(s);
        o.push(this.mID);
        o.push(v)
    }
    for (var h = 0; h < this.mColCnt; ++h) {
        if (this.mColDatas[h].mVisible) {
            o.push(u);
            o.push(this.mID);
            o.push(g);
            o.push(h);
            o.push(v)
        }
    }
    o.push("</DIV>")
};
BaseTable.prototype.RefreshHeaderRefs = function() {
    this.mColHdrObj = this.mFixedHeader ? this.mOuter.firstChild: this.mInner.firstChild;
    var d = this.mColHdrObj.firstChild;
    if (this.colCheck == 1) {
        this.mChkHdr = d;
        d = d.nextSibling
    }
    for (var b = 0; b < this.mColCnt; ++b) {
        if (this.mColDatas[b].mVisible) {
            this.mColDatas[b].mHeader = d;
            d = d.nextSibling
        } else {
            this.mColDatas[b].mHeader = null
        }
    }
    if (this.colCheck == 1) {
        this.mChkBar = d;
        d = d.nextSibling
    }
    for (var b = 0; b < this.mColCnt; ++b) {
        if (this.mColDatas[b].mVisible) {
            this.mColDatas[b].mBar = d;
            d = d.nextSibling
        } else {
            this.mColDatas[b].mBar = null
        }
    }
};
BaseTable.prototype.ApplyData = function() {
    var B = [],
    H = "<COL />";
    if (!this.mFirstLayout && this.mRowsPresent == 0 && this.GetData().length == 0 && !this.mDirtyColumns) {
        return
    }
    if (this.parent && this.parent.mObj && this.parent.mObj.getAttribute("arfillstyle") == 3) {
        var aa = this.mObj.className;
        if (this.GetData().length > 0) {
            if (aa.indexOf("tblflow") == -1) {
                aa += " tblflow";
                this.mObj.className = aa
            }
        } else {
            this.mObj.className = aa.replace("tblflow", "")
        }
    }
    var am = this.hasVisImgRefs();
    var d = needPNGFixup();
    this.mDirtyColumns = false;
    if (!this.mFixedHeader) {
        this.BuildColumnHeaders(B)
    }
    B.push("<TABLE ");
    B.push("id='T" + this.mID + "' ");
    var q = this.MakeTableTitle("").HTMLEncode();
    if (this.mHasHoverEvt) {
        q = ""
    }
    B.push('title="' + q + '"');
    var I = [];
    for (var aD = 0; aD < this.mColCnt; ++aD) {
        if (this.mColDatas[aD].mVisible) {
            I.push(H)
        }
    }
    var R = I.length;
    if (this.colCheck == 1) {
        R++
    }
    B.push(" class='BaseTable'><COLGROUP cols=" + R + ">");
    if (this.colCheck == 1) {
        B.push(H)
    }
    B.push(I.join(""));
    B.push("</COLGROUP><TBODY>");
    if (this.mSortImgs != null) {
        for (var aD in this.mSortImgs) {
            if (this.mSortImgs[aD].getAttribute("arindom") == 1) {
                if (this.mSortImgs[aD].parentNode != null) {
                    this.mSortImgs[aD] = this.mSortImgs[aD].parentNode.removeChild(this.mSortImgs[aD])
                }
                this.mSortImgs[aD].setAttribute("arindom", 0)
            }
        }
    }
    var ar = null;
    for (var aD in this.mColDatas) {
        if (this.mColDatas[aD].mPrimarySort) {
            ar = this.mColDatas[aD];
            break
        }
    }
    if (ar == null && this.mColDatas.length > 0) {
        var aG = this.GetInitialRowSortOrder();
        if (aG != null) {
            for (var aD in this.mColDatas) {
                var af = this.mColDatas[aD];
                if (af.mDataCol == aG.col) {
                    af.mPrimarySort = true;
                    af.mSortDir = aG.dir;
                    ar = af;
                    break
                }
            }
        }
    }
    if (ar != null) {
        this.SetRowSortOrder(ar.mDataCol, ar.mSortDir)
    }
    var aI;
    if (this.mColDatas.length == 0) {
        aI = []
    } else {
        aI = this.GetData()
    }
    this.mHiddenColHdrPresent = false;
    if (aI.length > 0) {
        var aF = this.GetColumnInfo();
        var ae = this.GetRowColours();
        var ah = this.GetBkgRowColours();
        var ag = {};
        var ai = [[], []],
        C = [[], []],
        g = [];
        var av = [[], []];
        var aE = [[], []];
        var Z = '<td class="BaseTableCellColor"><input class="colcheck" type=\'checkbox\' </td>';
        var f = '<td class="BaseTableCellOddColor"><input class="colcheck" type=\'checkbox\' </td>';
        var Y = "CLASSNAME",
        N = "<TH scope=col >",
        L = "</TH>";
        var o = false;
        var v = -1;
        if (this.colCheck == 1) {
            g.push(N)
        }
        g.push(L);
        for (var aD = 0; aD < this.mColCnt; ++aD) {
            if (this.mColDatas[aD].mVisible) {
                g.push(N);
                g.push(aF[this.mColDatas[aD].mDataCol].heading.HTMLEncode());
                g.push(L);
                ag[aD] = this.mColDatas[aD].mDataCol;
                var u = aF[ag[aD]];
                var an = "";
                var ac = this.getTemplateForField(ag[aD]);
                if (typeof ac != "undefined") {
                    if (ac.indexOf("btnurl") != -1) {
                        av[0][aD] = '<TD class="' + Y + '" ';
                        ai[0][aD] = '" valign=top>' + ac;
                        aE[0][aD] = "";
                        C[0][aD] = "</TD>"
                    } else {
                        av[0][aD] = '<TD class="' + Y + " ";
                        ai[0][aD] = '" valign=top><NOBR>' + ac;
                        aE[0][aD] = "";
                        C[0][aD] = "</NOBR></TD>"
                    }
                } else {
                    if (u.edit == 2) {
                        av[0][aD] = "<TD " + an + ' class="' + Y + '" ';
                        ai[0][aD] = '"><NOBR>';
                        aE[0][aD] = '<INPUT type=text class=BaseTableInlineEdit value="';
                        C[0][aD] = '" /></NOBR></TD>'
                    } else {
                        pretdtag = '"';
                        pretdtag += ((v == aD || !o) ? 'scope="row" ': "");
                        if (u.edit == 1) {
                            pretdtag += ' class="' + Y + ' BaseTableStaticText editT">'
                        } else {
                            pretdtag += ' class="' + Y + ' BaseTableStaticText">'
                        }
                        o = true;
                        if (u.wrap) {
                            av[0][aD] = "<TD ";
                            ai[0][aD] = pretdtag + "<SPAN>";
                            aE[0][aD] = "";
                            C[0][aD] = "</SPAN></TD>"
                        } else {
                            av[0][aD] = "<TD ";
                            ai[0][aD] = pretdtag + '<NOBR class="dp " style="padding: 1px 4px;">';
                            aE[0][aD] = "";
                            if (u.edit == 3) {
                                aE[0][aD] = ("<input type=checkbox value=" + u.mEnumValue);
                                C[0][aD] = ">&nbsp;" + u.mEnumLabel
                            } else {
                                C[0][aD] = ""
                            }
                            C[0][aD] += "</NOBR></TD>"
                        }
                    }
                }
            }
        }
        var al = "BaseTableCellColor";
        var G = "BaseTableCellOddColor";
        if (this.mGroup) {
            al = G
        }
        if (ah != null) {
            al = "";
            G = ""
        }
        for (var aD in ai[0]) {
            al = al.replace("BaseTableAlignText", "");
            G = G.replace("BaseTableAlignText", "");
            if (this.mColDatas[aD].mType) {
                if (this.mColDatas[aD].mType == "Currency" || this.mColDatas[aD].mType == "Integer" || this.mColDatas[aD].mType == "Decimal" || this.mColDatas[aD].mType == "Real") {
                    al += " BaseTableAlignText";
                    G += " BaseTableAlignText";
                    aE[0][aD] = aE[0][aD].replace("BaseTableInlineEdit", "BaseTableInlineNumEdit")
                }
            }
            av[1][aD] = av[0][aD].replace(Y, "BaseTableCell " + al);
            av[0][aD] = av[0][aD].replace(Y, "BaseTableCellOdd " + G);
            ai[1][aD] = ai[0][aD].replace(Y, "BaseTableCell " + al);
            ai[0][aD] = ai[0][aD].replace(Y, "BaseTableCellOdd " + G);
            aE[1][aD] = aE[0][aD].replace(Y, "BaseTableCell " + al);
            aE[0][aD] = aE[0][aD].replace(Y, "BaseTableCellOdd " + G);
            C[1][aD] = C[0][aD].replace(Y, "BaseTableCell " + al);
            C[0][aD] = C[0][aD].replace(Y, "BaseTableCellOdd " + G)
        }
        var p = [];
        var w = [];
        for (var aC = 0; aC < this.mColCnt; ++aC) {
            if (this.mColDatas[aC].mVisible) {
                p.push("content.push(prepre[" + aC + "]);");
                p.push("content.push(cColor[" + ag[aC] + "]);");
                p.push("content.push(premap[" + aC + "]);");
                if (am) {
                    var ac = this.getTemplateForField(ag[aC]);
                    if (typeof ac != "undefined") {
                        p.push("")
                    } else {
                        p.push("content.push(irArr[" + ag[aC] + "]);")
                    }
                }
                p.push("content.push(postimg[" + aC + "]);");
                if (aF[this.mColDatas[aC].mDataCol].edit == 3) {
                    p.push("content.push(di.d[" + ag[aC] + "].v=='" + aF[ag[aC]].mEnumLabel + "'?' CHECKED ':' ');")
                } else {
                    p.push("content.push(di.d[" + ag[aC] + "].v);")
                }
                p.push("content.push(postmap[" + aC + "]);")
            } else {
                if (this.mGroup && this.mGroupOrder[0] == this.mColDatas[aC].mDataCol) {
                    if ("e" in this.mColFields[aC].mObj) {
                        for (var ay in this.mColFields[aC].mObj.e) {
                            w.push(this.mColFields[aC].mObj.e[ay].l)
                        }
                    }
                }
            }
        }
        p = p.join("");
        var ax = "di,content,premap,postmap,prepre,postimg,cColor";
        if (am) {
            ax = "di,content,premap,postmap,prepre,postimg,cColor,irArr"
        }
        CompileFunction(p, ax);
        rowfunc = CompiledFunction;
        this.mHiddenColHdrPresent = true;
        B.push('<TR class="hiddentablehdr">');
        B.push(g.join(""));
        B.push("</TR>");
        var aj = "</TR>",
        P = ">";
        var ab = "<TR tabindex=0 arrow=";
        var aC = 0,
        az = "",
        S = 0,
        W = "",
        X = [];
        var E = aI[0].d.length;
        var b = "<TR class='separator'><TD colspan='" + E + "'><hr class='separator'></TD></TR>";
        var aH = 20;
        var aw = 13;
        var ad = "TTT";
        var K = /[~`!@#$%^&*={}\[\]\\|.:;/ ? \s] / g;
        if (ae == null && ah == null) {
            for (var aD = 0; aD < aI.length; ++aD) {
                if (!aI[aD].mXXXDirty || aI[aD].mXXXDirty != 3) {
                    var s;
                    if (am) {
                        s = this.getVisImgRefs(aI[aD], d)
                    }
                    if (this.mGroup) {
                        var U = aI[aD].d[this.mGroupOrder[0]].v;
                        if (U == null || U == "") {
                            U = "NULL"
                        }
                        if (az != U) {
                            if (U.length * aw > aH) {
                                aH = U.length * aw
                            }
                            W = U.replace(K, "");
                            if (W == "" || W == "NULL") {
                                dd = new Date();
                                W = "NULL" + dd.getTime()
                            }
                            if (aD > 0) {
                                B.push(b)
                            }
                            if (az != "") {
                                if (this.mFunc) {
                                    B[S] = "<span class='aggregate'>" + this.getandresetAggregate() + "</span></nobr></td>"
                                } else {
                                    B[S] = "</nobr></td>"
                                }
                            }
                            B.push("<TR id='" + W + "'><TD colspan='" + E + "' style='padding:0.3em 1.5em'>");
                            if (am) {
                                B.push(s[this.mGroupOrder[0]])
                            }
                            B.push("<nobr><span class='folder' style='width:" + ad + "px'>" + U + "</span>");
                            B.push("");
                            S = B.length - 1;
                            B.push("</TR>");
                            az = U;
                            X.push(az)
                        }
                    }
                    var O = this.getCellColor(aI[aD]);
                    B.push(ab);
                    B.push(aD);
                    if (this.mGroup) {
                        this.computeAggregate("COUNT", aI[aD]);
                        var ak = "child-of-" + W;
                        B.push(" class='" + ak + "'")
                    }
                    B.push(P);
                    if (this.colCheck == 1) {
                        if (Math.floor(aD % 2) == 0) {
                            B.push(f)
                        } else {
                            B.push(Z)
                        }
                    }
                    if (am) {
                        rowfunc(aI[aD], B, ai[aC & 1], C[aC & 1], av[aC & 1], aE[aC & 1], O, s)
                    } else {
                        rowfunc(aI[aD], B, ai[aC & 1], C[aC & 1], av[aC & 1], aE[aC & 1], O)
                    }
                    B.push(aj);
                    aC++
                }
            }
        } else {
            var aB = [];
            var V = null;
            if (ae == null) {
                V = ah
            } else {
                if (ah == null) {
                    V = ae
                } else {
                    V = (ae.length > ah.length ? ae: ah)
                }
            }
            for (var aD in V) {
                var J = "<TR tabindex=0 style='";
                if (ae != null && aD < ae.length) {
                    J += ae[aD]
                }
                if (ah != null && aD < ah.length) {
                    J += ah[aD]
                }
                J += "' arrow=";
                aB[aD] = J
            }
            aB[ - 1] = ab;
            for (var aD = 0; aD < aI.length; ++aD) {
                if (!aI[aD].mXXXDirty || aI[aD].mXXXDirty != 3) {
                    var s;
                    if (am) {
                        s = this.getVisImgRefs(aI[aD], d)
                    }
                    if (this.mGroup) {
                        var U = aI[aD].d[this.mGroupOrder[0]].v;
                        if (U == null || U == "") {
                            U = "NULL"
                        }
                        if (az != U) {
                            if (U.length * aw > aH) {
                                aH = U.length * aw
                            }
                            W = U.replace(K, "");
                            if (W == "" || W == "NULL") {
                                dd = new Date();
                                W = "NULL" + dd.getTime()
                            }
                            if (aD > 0) {
                                B.push(b)
                            }
                            if (az != "") {
                                if (this.mFunc) {
                                    B[S] = "<span class='aggregate'>" + this.getandresetAggregate() + "</span></nobr></td>"
                                } else {
                                    B[S] = "</nobr></td>"
                                }
                            }
                            B.push("<TR id='" + W + "'><TD colspan='" + E + "'>");
                            if (am) {
                                B.push(s[this.mGroupOrder[0]])
                            }
                            B.push("<nobr><span class='folder' style='width:" + ad + "px'>" + U + "</span>");
                            B.push("");
                            S = B.length - 1;
                            B.push("</TR>");
                            az = U;
                            X.push(az)
                        }
                    }
                    var O = this.getCellColor(aI[aD]);
                    var D = aI[aD];
                    B.push(aB[D.rc]);
                    B.push(aD);
                    if (this.mGroup) {
                        this.computeAggregate("COUNT", aI[aD]);
                        var ak = "child-of-" + W;
                        B.push(" class='" + ak + "'")
                    }
                    B.push(P);
                    if (this.colCheck == 1) {
                        if (Math.floor(aD % 2) == 0) {
                            B.push(f)
                        } else {
                            B.push(Z)
                        }
                    }
                    if (am) {
                        rowfunc(aI[aD], B, ai[aC & 1], C[aC & 1], av[aC & 1], aE[aC & 1], O, s)
                    } else {
                        rowfunc(aI[aD], B, ai[aC & 1], C[aC & 1], av[aC & 1], aE[aC & 1], O)
                    }
                    B.push(aj);
                    aC++
                }
            }
        }
        if (this.mGroup) {
            if (this.mFunc) {
                B[S] = "<span class='aggregate'>" + this.getandresetAggregate() + "</span></nobr></td>"
            } else {
                B[S] = "</nobr></td>"
            }
            for (var aq in w) {
                var au = false;
                for (x in X) {
                    if (w[aq] == X[x]) {
                        au = true
                    }
                }
                if (!au) {
                    B.push(b);
                    if (w[aq].length * aw > aH) {
                        aH = w[aq].length * aw
                    }
                    B.push("<TR class='emptyGroup' id='" + w[aq] + "'><TD colspan='" + E + "'>");
                    if (am) {
                        B.push(s[this.mGroupOrder[0]])
                    }
                    B.push("<nobr><span class='folder' style='width:" + ad + "px'>" + w[aq] + "</span>");
                    if (this.mFunc) {
                        B.push("<span class='aggregate'>0</span></nobr></td>")
                    } else {
                        B.push("</nobr></td>")
                    }
                    B.push("</TR>")
                }
            }
        }
    }
    B.push("</TBODY></TABLE>");
    if (this.mGroup) {
        this.mFolderStatus = this.getAllFolderStatus();
        if (aH > this.mWidth) {
            aH = this.mWidth - 80
        }
        var Q = B.join("");
        Q = Q.replace(/TTT/g, aH);
        this.mInner.innerHTML = Q
    } else {
        this.mInner.innerHTML = B.join("")
    }
    this.mRowsPresent = aI.length;
    this.mDataTableObj = this.mFixedHeader ? this.mInner.firstChild: this.mInner.childNodes[1];
    if (!this.mFixedHeader) {
        this.RefreshHeaderRefs();
        this.mDataTableObj.style.top = 16
    }
    var ao = this.mDataTableObj.lastChild;
    e = this.mDataTableObj.firstChild.firstChild;
    if (this.colCheck == 1) {
        e = e.nextSibling
    }
    var A = this.mRowsPresent >= 100;
    for (var aD = 0; aD < this.mColCnt; ++aD) {
        if (this.mColDatas[aD].mVisible) {
            var at = this.mColDatas[aD];
            at.mColumn = e;
            at.mBar.setAttribute("dragoriginal", A ? "": "1");
            if (at.mPrimarySort && this.mSortImgs != null) {
                if (at.mSortDir == -1) {
                    at.mHeader.appendChild(this.mSortImgs[0]);
                    this.mSortImgs[0].setAttribute("arindom", 1)
                } else {
                    at.mHeader.appendChild(this.mSortImgs[1]);
                    this.mSortImgs[1].setAttribute("arindom", 1)
                }
            }
            e = e.nextSibling
        } else {
            this.mColDatas[aD].mColumn = null
        }
    }
    for (var aD = 0; aD < aI.length; ++aD) {
        for (var aA = 0; aA < this.mColCnt; ++aA) {
            if (aI[aD].d[aA].h == "1") {
                var h = this.findHtmlObject(aD, aA);
                if (h) {
                    h.firstChild.style.visibility = "hidden"
                }
            }
        }
    }
    this.ApplySizes();
    this.mLastRowSelections = {};
    this.ApplySelections(true, false);
    this.mFirstLayout = false
};
BaseTable.prototype.checkSelDeselall = function(d) {
    if (this.colCheck == 1 && this.IsRefreshed()) {
        if (d) {
            this.mChkHdr.firstChild.checked = true
        } else {
            this.mChkHdr.firstChild.checked = false
        }
        var b = this.mDataTableObj.lastChild;
        var f = b.firstChild.nextSibling;
        while (true) {
            if (f == null) {
                break
            }
            if (d) {
                f.firstChild.firstChild.checked = true
            } else {
                f.firstChild.firstChild.checked = false
            }
            f = f.nextSibling
        }
    }
};
BaseTable.prototype.ApplySizes = function() {
    var f = this.mColCnt - 1,
    s = this.GetColumnInfo(),
    w = 0,
    o = 0,
    b = null;
    while (f >= 0 && (!this.mColDatas[f].mVisible || this.mColDatas[f].mWidth <= 0)) {--f
    }
    if (f < 0) {
        return
    }
    if (this.colCheck == 1) {
        if (this.mDataTableObj != null && this.mDataTableObj.firstChild != null && this.mDataTableObj.firstChild.firstChild != null) {
            var k = this.mChkHdr;
            var g = this.mChkBar;
            if (k != null && g != null) {
                k.style.left = 0;
                k.style.width = 25;
                g.style.visibility = "inherit";
                w += 25;
                g.style.left = w - 6;
                var p = this.mDataTableObj.firstChild.firstChild;
                p.style.width = 25
            }
        }
    }
    for (var q = 0; q < this.mColCnt; ++q) {
        var d = this.mColDatas[q];
        if (this.mColDatas[q].mVisible) {
            if (d.mColumn == null || d.mHeader == null) {
                return
            }
            d.mHeader.style.left = w;
            d.mX = w;
            d.mBar.style.visibility = (q >= f || d.mWidth <= 0 ? "hidden": "inherit");
            d.mBar.setAttribute("arcolumnid", q);
            d.mHeader.style.width = d.mColumn.style.width = d.mWidth;
            w += d.mWidth;
            if (q == 0 && this.mGroup) {
                d.mHeader.style.width = d.mColumn.style.width = d.mWidth + 16;
                w += 16
            }
            d.mBarX = w - 6;
            d.mBar.style.left = d.mBarX
        }
    }
    this.mColHdrObj.style.width = (w > this.mWidth ? w: this.mWidth);
    if ((this.mHScroll || this.mAccHScroll) && w > this.mWidth) {
        this.mInner.style.overflow = "auto";
        if (this.mRowsPresent == 0 && this.mFixedHeader) {
            var h = document.createElement("td");
            h.style.width = w;
            var v = document.createElement("tr");
            v.appendChild(h);
            this.mDataTableObj.lastChild.appendChild(v)
        }
    } else {
        this.mInner.style.overflowY = "auto";
        this.mInner.style.overflowX = "hidden";
        this.mInner.scrollLeft = this.mScrollLeft = 0;
        o = this.mInner.offsetWidth - this.mInner.clientWidth;
        var u = (this.mColDatas[f].mWidth + (this.mWidth - w) - o);
        b = (u <= 0 ? this.mColDatas[f].mWidth: u);
        this.mColDatas[f].mColumn.style.width = this.mColDatas[f].mHeader.style.width = this.mColDatas[f].mWidth = b
    }
    this.ApplyExpensivePatchup(w, f, b)
};
BaseTable.prototype.FindContainingDiv = function(b) {
    while (b && b.tagName && (b.nodeType != 1 || b.tagName != "DIV")) {
        b = b.parentNode
    }
    return b
};
function TableBtn(d, g, h, b) {
    this.name = d;
    this.mObj = document.createElement("A");
    this.mObj.className = h + " btn btn3d TableBtn";
    this.mObj.href = "javascript:";
    if (b != null) {
        var f = d + "&nbsp;<img style=border:none alt='' src='" + b + "'>";
        this.mObj.innerHTML = f
    } else {
        this.mObj.appendChild(document.createTextNode(d))
    }
    g.appendChild(this.mObj)
}
TableBtn.prototype.SetVisibility = function(b) {
    this.mObj.style.visibility = (b ? "inherit": "hidden")
};
TableBtn.prototype.SetAccess = function(b) {
    this.mObj.disabled = !b;
    FakeButton_SetDisable(this.mObj, this.mObj.disabled)
};
BaseTable.prototype.ResetCellDisplay = function(d, b) {
    if (d <= 0) {
        b.firstChild.style.display = "none";
        b.style.display = "none"
    } else {
        b.firstChild.style.display = "";
        b.style.display = ""
    }
};
BaseTable.prototype.ClearDisplayNone = function(b) {
    if (b.style.display == "none") {
        b.style.display = ""
    }
};
BaseTable.prototype.ApplyExpensivePatchup = function(o, f, b) {
    var u = this.FishOutTR(0),
    p = this.mColDatas,
    g = null;
    if (u == null) {
        return
    }
    if (this.mHScroll || this.mAccHScroll) {
        this.mDataTableObj.style.width = o
    }
    while (u != null) {
        var s = u.firstChild;
        this.ClearDisplayNone(s);
        if (g == null) {
            var q = document.defaultView.getComputedStyle(s, "");
            g = 0;
            if (q != null) {
                g = parseInt(q.getPropertyValue("padding-left"));
                if (isNaN(g)) {
                    g = 0
                }
            }
        }
        if (this.colCheck == 1) {
            var d = this.mAccmWidth - g;
            s.style.width = s.firstChild.style.width = (d < 0 ? 0 : d);
            this.ResetCellDisplay(d, s);
            s = s.nextSibling;
            this.ClearDisplayNone(s)
        }
        for (var h = 0; h < this.mColCnt; ++h) {
            if (p[h].mVisible && s != null && (s.firstChild == null || s.firstChild.tagName != "HR")) {
                var k;
                if (h == f && b != null) {
                    k = b - g
                } else {
                    k = p[h].mWidth - g
                }
                s.style.width = s.firstChild.style.width = (k < 0 ? 0 : k);
                this.ResetCellDisplay(k, s);
                s = s.nextSibling
            }
        }
        u = u.nextSibling
    }
};
BaseTable.prototype.calRowSel = function(b) {
    var f = this.mLastRowSelection;
    if (b < 0) {
        for (var d = f + b; d >= 0; d--) {
            if ((!this.mResult.r[d].mXXXDirty) || (this.mResult.r[d].mXXXDirty != 3)) {
                return d
            }
        }
    } else {
        for (var d = f + b; d < this.mResult.r.length; d++) {
            if ((!this.mResult.r[d].mXXXDirty) || (this.mResult.r[d].mXXXDirty != 3)) {
                return d
            }
        }
    }
    return this.mLastRowSelection
};
BaseTable.prototype.hasRootImg = function() {
    return false
};
BaseTable.prototype.getRootImgW = function() {
    return 0
};
BaseTable.prototype.getRootImgH = function() {
    return 0
};
BaseTable.prototype.getRootImgURL = function() {
    return null
};
BaseTable.prototype.getRootImgAltT = function() {
    return null
};
BaseTable.prototype.getRootImgFType = function() {
    return null
};
BaseTable.prototype.getRootImgRef = function(b, d) {
    return ""
};
BaseTable.prototype.getImgRefCell = function(b, g, d, f) {
    return ""
};
BaseTable.prototype.getNoDragDropStyleClasses = function() {
    return ["BaseTableHeader", "BaseTableBar"]
};
BaseTable.prototype.computeAggregate = function(b, d) {
    if (b == "COUNT") {
        this.mAggregateVal++
    }
};
BaseTable.prototype.getandresetAggregate = function() {
    var b = this.mAggregateVal;
    this.mAggregateVal = 0;
    return b
};
SimpleTable.prototype = new BaseTable();
SimpleTable.prototype.constructor = SimpleTable;
SimpleTable.superclass = BaseTable.prototype;
SimpleTable.prototype.mHaveStoredData = false;
SimpleTable.prototype.MouseSelectable = false;
function SimpleTable(d, o, k, b, f, h, g) {
    if (arguments.length) {
        this.init(d, o, k, b, f, h, g)
    }
}
SimpleTable.prototype.init = function(h, f, g, b, o, k, w) {
    this.mResult = k;
    this.mSort = o;
    this.mColInfo = [];
    for (var q = 0; q < this.mResult.h.length; ++q) {
        this.mColInfo.push({
            heading: this.mResult.h[q],
            wrap: false,
            edit: 0
        })
    }
    var u = document.createElement("div");
    u.className = "TableHdr";
    g.appendChild(u);
    this.mHdrObj = u;
    u = document.createElement("div");
    u.className = "TableInner";
    g.appendChild(u);
    this.mInnerObj = u;
    u = document.createElement("div");
    u.className = "TableFtr";
    g.appendChild(u);
    this.mFtrObj = u;
    this.mHdrObj.innerHTML = "<TABLE class='TableHdr' cellpadding=0 cellspacing=0><TBODY><TR><TD NOWRAP VALIGN=middle class='TableHdrL'></TD><TD NOWRAP VALIGN=middle class='TableHdrR'></TD></TR></TBODY></TABLE>";
    this.mFtrObj.innerHTML = "<TABLE class='TableFtr' cellpadding=0 cellspacing=0><TBODY><TR><TD NOWRAP VALIGN=middle class='TableFtrL'></TD><TD NOWRAP VALIGN=middle class='TableFtrR'></TD></TR></TBODY></TABLE>";
    var d = this.mHdrObj.firstChild.firstChild.firstChild;
    this.mHdrLObj = d.childNodes[0];
    this.mHdrRObj = d.childNodes[1];
    d = this.mFtrObj.firstChild.firstChild.firstChild;
    this.mFtrLObj = d.childNodes[0];
    this.mFtrRObj = d.childNodes[1];
    this.mSortOrder = [];
    this.mCurrentRow = -1;
    SimpleTable.superclass.init.call(this, h, f, g, true, b, false);
    if (w) {
        var s = [this.mHdrObj.firstChild.firstChild.firstChild, this.mFtrObj.firstChild.firstChild.firstChild];
        for (var q = 0; q < w.length; ++q) {
            w[q].node = new TableBtn(w[q].name, s[w[q].bar].childNodes[w[q].loc], w[q].name, null)
        }
        this.mButtons = w
    } else {
        this.mButtons = null
    }
    SimpleTable.superclass.InstantiateUI.call(this, this.mInnerObj);
    this.SetDefaultSizes();
    var y = g.offsetHeight;
    if (y == undefined) {
        var v = g.style.height;
        y = parseInt(v)
    }
    this.Resize(g.offsetWidth, y);
    this.ApplyData();
    this.mHasChildFields = false
};
SimpleTable.prototype.getHoverEvtList = function() {
    return []
};
SimpleTable.prototype.Clear = function() {
    this.S(Null)
};
SimpleTable.prototype.DOMClick = function(b) {
    if (this.GAccess() == 3) {
        return
    }
    var g = this.FindContainingDiv(b.element);
    if (g == null) {
        return
    }
    if (g.className == "TableHdr" || g.className == "TableFtr") {
        g = b.element;
        if (g.tagName != "A") {
            return
        }
        for (var f = 0; f < this.mButtons.length; ++f) {
            if (this.mButtons[f].node.mObj == g) {
                return this.mButtons[f].func.call(this, [])
            }
        }
        return
    }
    var d = {
        c: {
            f: SimpleTable.superclass.DOMClick,
            a: [b],
            t: this
        }
    };
    if (this.GLabel() == getLocalizedMessage("Selection")) {
        d.n = {
            f: this.ARDrillDown,
            t: this
        }
    }
    return d
};
SimpleTable.prototype.DOMKeyDown = function(b) {
    if (this.GAccess() == 3) {
        return
    }
    var d = this.FindContainingDiv(b.element);
    if (d == null) {
        return
    }
    if (d.className == "TableHdr" || d.className == "TableFtr") {
        return
    }
    return SimpleTable.superclass.DOMKeyDown.call(this, b)
};
SimpleTable.prototype.GetSelectedRow = function() {
    return this.RowNoFromTag(this.mPrimaryRowSelection)
};
SimpleTable.prototype.GetColumnInfo = function() {
    return this.mColInfo
};
SimpleTable.prototype.GetInitialColumnWidths = function() {
    return this.mResult.w
};
SimpleTable.prototype.GetData = function() {
    if (this.mResult) {
        return this.mResult.r
    } else {
        return []
    }
};
SimpleTable.prototype.SetRowSortOrder = function(f, h, b, p) {
    if (f == this.mSortOrder.col && h == this.mSortOrder.dir) {
        return null
    }
    if (!this.mResult) {
        return null
    }
    if (!this.mSort) {
        return null
    }
    var d = false;
    if (b != null) {
        for (var k in b) {
            d = true;
            this.mResult.r[k].seltag = 0
        }
        if (p != -1) {
            this.mResult.r[p].seltag = 1
        }
    }
    if (f == this.mSortOrder.col && h != this.mSortOrder.dir) {
        this.mResult.r.reverse()
    } else {
        this.mResult.r.sort(function(s, u) {
            return s.d[f].v.localeCompare(u.d[f].v)
        })
    }
    var g = -1,
    q = [],
    o;
    if (d) {
        for (var k in this.mResult.r) {
            o = this.mResult.r[k];
            if ("seltag" in o) {
                if (o.seltag == 1) {
                    g = k
                }
                q[k] = 1;
                delete this.mResult.r[k].seltag
            }
        }
    }
    return {
        rows: q,
        primary: g
    }
};
SimpleTable.prototype.GetInitialRowSortOrder = function() {
    if (this.mColCnt > 0) {
        return {
            col: 0,
            dir: 1
        }
    }
    return null
};
SimpleTable.prototype.GetRowColours = function() {
    return null
};
SimpleTable.prototype.GetBkgRowColours = function() {
    return null
};
SimpleTable.prototype.SetFocusToFirstRow = function() {
    var b = this.FishOutTR(0);
    if (b != null && b.focus) {
        b.focus()
    }
};
SimpleTable.prototype.mSortImgs = null;
DTable.prototype = new BaseTable();
DTable.prototype.constructor = DTable;
DTable.superclass = BaseTable.prototype;
DOMFieldFactories.Table = function(b, f, d) {
    return new DTable(b, f, d)
};
DTable.prototype.mHaveStoredData = false;
DTable.prototype.MouseSelectable = false;
function DTable(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DTable.prototype.MeddleResultsList = function() {
    var b = this.mObj;
    if (getForm_NS(this.windowID).RLReport) {
        b.setAttribute("arrepstr", getLocalizedMessage("Report"))
    }
    b.setAttribute("arselallstr", getLocalizedMessage("Select All"));
    b.setAttribute("ardeselallstr", getLocalizedMessage("DeSelect All"));
    if (getForm_NS(this.windowID).RLDelete) {
        b.setAttribute("ardeletestr", getLocalizedMessage("Delete"))
    }
    b.setAttribute("arrefstr", getLocalizedMessage("Refresh"));
    b.setAttribute("arprefsstr", getLocalizedMessage("Preferences"));
    if (parseInt(b.getAttribute("archunkbuttons")) != null) {
        b.setAttribute("arentretstr", getLocalizedMessage("Showing {0} - {1} of {3}"))
    } else {
        b.setAttribute("arentretstr", getLocalizedMessage("{2} entries returned - {3} entries matched"))
    }
};
DTable.prototype.Resize = function(d, b) {
    if (this.mAsyncMode) {
        this.mAsyncResizePending = {
            w: d,
            h: b
        };
        this.mAsyncDirty = (1 > this.mAsyncDirty ? 1 : this.mAsyncDirty)
    } else {
        this.DoResize(d, b)
    }
};
DTable.prototype.ResizeTo = function(f, b) {
    var d = Math.round(b * (this.perHeight / 100));
    var g = f;
    if (g < this.mMinWidth) {
        g = this.mMinWidth
    } else {
        if (g > this.mMaxWidth) {
            g = this.mMaxWidth
        }
    }
    if (d < this.mMinHeight) {
        d = this.mMinHeight
    } else {
        if (d > this.mMaxHeight) {
            d = this.mMaxHeight
        }
    }
    this.Resize(g, d)
};
DTable.prototype.DoResize = function(d, b) {
    DTable.superclass.Resize.call(this, d, b);
    var f = F(this.windowID, this.mContainerID);
    if (f instanceof DPage && f.mFillModel && f.mState == 1 && f.mFit) {
        f.getChildScroll(this)
    }
};
DTable.prototype.init = function(h, f, g) {
    this.mGroup = false;
    this.mFunc = false;
    this.mAggregateVal = 0;
    var w = g.getAttribute("argroup");
    if (w != null && w != "") {
        this.mGroup = true;
        this.mGroupOrder = [];
        var B = w.split(",");
        for (var q = 0; q < B.length; q += 2) {
            this.mGroupOrder.push(parseInt(B[q]));
            this.mGroupOrder.push(parseInt(B[q + 1]))
        }
    }
    var u = g.getAttribute("arfunc");
    if (u != null && u != "") {
        this.mFunc = true;
        this.mFuncOrder = [];
        var k = u.split(",");
        for (var q = 0; q < k.length; q += 2) {
            this.mFuncOrder.push(parseInt(k[q]));
            this.mFuncOrder.push(parseInt(k[q + 1]))
        }
    }
    if (g.getAttribute("arcols") == "") {
        this.mColInfo = this.mColFields = []
    } else {
        var v = g.getAttribute("arcols").split(",");
        var s = g.getAttribute("arcoldlen").split(",");
        var b = g.getAttribute("arcolwrap");
        this.mColInfo = [];
        this.mColFields = [];
        for (var q = 0; q < v.length; ++q) {
            var d = getFields_NS(h);
            this.mColFields[q] = d[v[q]];
            this.mColInfo.push({
                heading: this.mColFields[q].mObj.lbl,
                edit: 0,
                wrap: (b == null ? false: (b.charAt(q) == "1")),
                dLen: s[q],
                lcl: (typeof this.mColFields[q].mObj.lcl == "undefined" ? false: true)
            });
            this.mColFields[q].mObj.dataidx = q
        }
    }
    if (g.getAttribute("arcols") != "") {
        var A = g.getAttribute("arcoledit");
        for (var q = 0; q < v.length; ++q) {
            if (A != null) {
                if (A.charAt(q) == "1") {
                    if (this.mColFields[q].mObj.t.indexOf("Enum") == -1) {
                        this.mColInfo[q].edit = 2
                    }
                }
            } else {
                this.mColInfo[q].edit = 0
            }
        }
    }
    if (!this.mGroup) {
        this.colCheck = g.getAttribute("arcolcheck")
    } else {
        this.colCheck = 0
    }
    if (g.getAttribute("arcsize") != null) {
        this.mChunkSize = parseInt(g.getAttribute("arcsize"))
    } else {
        this.mChunkSize = 0
    }
    this.mChunkPage = 0;
    this.mServer = "";
    this.mSchema = "";
    DTable.superclass.init.call(this, h, f, g, (g.getAttribute("arfixhdr") == "1"), parseInt(g.getAttribute("arselrows")), !parseInt(g.getAttribute("arautofit")));
    if (this.mGroup) {
        for (var q = 0; q < this.mGroupOrder.length; q += 2) {
            this.mColDatas[this.mGroupOrder[q]].mVisible = false
        }
    }
    if (this.mObj.getAttribute("ardbn") == "CustomResultsList") {
        this.MeddleResultsList()
    }
    if (this.mID == 1020) {
        this.mCFCache.v = false
    }
    this.mMode = this.mObj.getAttribute("arselinit");
    this.mSortOrder = [];
    this.mCurrentRow = -1;
    this.mNotRefreshed = true;
    this.mRefreshInterval = 0;
    this.mHasChildFields = true;
    var o = false;
    var p = this.getHoverEvtList();
    var y = null;
    for (var q = 0; q < p.length; q++) {
        idx = q;
        y = AREventFunction(h, p[q], this.mID);
        if (y != null) {
            o = true;
            break
        }
    }
    if (!o) {
        o = this.hoverEvtonChildren()
    }
    this.mHasHoverEvt = o;
    getTableFields_NS(h).push(this)
};
DTable.prototype.isCustomResultsList = function() {
    return (this.mObj.getAttribute("ardbn") == "CustomResultsList")
};
DTable.prototype.isChild = function(f) {
    var d = false;
    for (var b = 0; b < this.mColFields.length; b++) {
        if (this.mColFields[b].mID == f) {
            d = true;
            break
        }
    }
    return d
};
DTable.prototype.getColNum = function(d) {
    for (var b = 0; b < this.mColFields.length; b++) {
        if (this.mColFields[b].mID == d) {
            return b
        }
    }
    return - 1
};
DTable.prototype.InstantiateUI = function() {
    var b = this.mObj;
    this.InstantiateUI_Part1(b);
    this.InstantiateUI_Part2(b)
};
DTableMenu.prototype = new Menu();
DTableMenu.prototype.constructor = DTableMenu;
DTableMenu.superclass = Menu.prototype;
function DTableMenu(b, f, d) {
    if (arguments.length) {
        return {
            n: {
                f: this.init,
                t: this,
                a: [b, f, d]
            }
        }
    }
}
DTableMenu.prototype.init = function(b, f, d) {
    DTableMenu.superclass.init.call(this, b, f);
    this.mTable = d;
    this.mName = getLocalizedMessage("Table Chunk Page");
    return {
        n: {
            f: this.Open,
            t: this,
            a: [d.mChunkMenuBtn, 1, null, false]
        }
    }
};
DTableMenu.prototype.HandleSelection = function(f) {
    var b = getCurWFC_NS(this.windowID);
    var d = parseInt(f);
    if (d != this.mChunkPage) {
        this.mTable.mChunkPage = d;
        if (b != null) {
            return {
                n: {
                    f: this.mTable.Refresh,
                    t: this.mTable,
                    a: [ - 1, 0, false]
                }
            }
        } else {
            new WorkflowContext(this.windowID, {
                t: this.mTable,
                f: this.mTable.Refresh,
                a: [ - 1, 0, false]
            })
        }
    }
};
DEditMenu.prototype = new Menu();
DEditMenu.prototype.constructor = DEditMenu;
DEditMenu.superclass = Menu.prototype;
function DEditMenu(b, k, d, h, g, f) {
    if (arguments.length) {
        return {
            n: {
                f: this.init,
                t: this,
                a: [b, k, d, h, g, f]
            }
        }
    }
}
DEditMenu.prototype.init = function(b, k, d, h, g, f) {
    DTableMenu.superclass.init.call(this, b, k);
    this.mDataX = g;
    this.mXY = h;
    this.mLastRefreshTime = f.mLastRefreshTime;
    this.mTable = f;
    return {
        n: {
            f: this.Open,
            t: this,
            a: [d, 3, null, false]
        }
    }
};
DEditMenu.prototype.HandleSelection = function(d) {
    var b = getCurWFC_NS(this.windowID);
    if (this.mTable.mLastRefreshTime != this.mLastRefreshTime) {
        return
    }
    if (b != null) {
        return {
            n: {
                f: this.HandleSelectionInt,
                t: this,
                a: [d]
            }
        }
    } else {
        new WorkflowContext(this.windowID, {
            t: this,
            f: this.HandleSelectionInt,
            a: [d]
        })
    }
};
DEditMenu.prototype.HandleSelectionInt = function(f) {
    var d = this.mTable.GetRow();
    this.mTable.SetRow(this.mXY.y);
    if (this.mTable.mColFields[this.mDataX].mObj.t == "Char") {
        var b = getLocalizedMessage("(no entries in menu)");
        this.mTable.mColFields[this.mDataX].S((f == b || f == "") ? Null: new CharType(f))
    } else {
        this.mTable.mColFields[this.mDataX].S(f == "" ? Null: new EnumType(f))
    }
    this.mTable.SetRow(d)
};
DTable.prototype.hasContextMenu = true;
DTable.prototype.getImgRefIds = function() {
    var g = new Array();
    var d = 0;
    if (this.hasImgRefs()) {
        for (var f = 0; f < this.mColFields.length; f++) {
            if (this.mColFields[f].hasImgRef()) {
                var b = this.mColFields[f].getImgFid();
                g[d] = b;
                d++
            }
        }
    }
    return g
};
DTable.prototype.getCColorIds = function() {
    var b = new Array();
    var g = 0;
    if (this.hasCellColor()) {
        for (var f = 0; f < this.mColFields.length; f++) {
            if (this.mColFields[f].hasCellColor()) {
                var d = this.mColFields[f].getCColorFid();
                b[g] = d;
                g++
            }
        }
    }
    return b
};
DTable.prototype.LoadResultsList = function(state, qual, arg, encodedQual, vuiId, search_label, search_ids, search_vals) {
    this.mResultsListState = state;
    this.mChunkPage = 0;
    if (!this.mUIInstantiated) {
        this.GetSortPreference()
    }
    if (typeof qual == "undefined") {
        qual = {
            qual: "",
            fieldids: [],
            fieldvals: [],
            fieldtypes: []
        }
    }
    var irid = this.getImgRefIds();
    var ccid = this.getCColorIds();
    var bloadFirst = (this.mMode == 0 || this.mMode == 1 ? true: false);
    var loadEntryId = "-1";
    if (bloadFirst) {
        loadEntryId = "0"
    }
    this.arg = arg;
    if (ShowWaitCursor()) {
        return this.RefreshTable( - 1, 0, false,
        function(start, maxrows, dataWrapper) {
            return {
                isFromFunctionSplit: 1,
                c: {
                    t: this,
                    f: function() {
                        var qbe = getQBE_NS(this.windowID);
                        if (qbe) {
                            var result = qbe;
                            if ("q" in result) {
                                eval("this.mQual=" + result.q)
                            }
                            if (result.n > 0) {
                                var fldids = [],
                                fldvals = [],
                                fldtypes = [];
                                if (this.arg) {
                                    this.arg.ToArrays(fldids, fldvals, fldtypes);
                                    this.arg = null
                                }
                                if (fldids.length == 0) {
                                    var refreshmode = parseInt(this.mObj.getAttribute("arselrefresh"));
                                    return this.RefreshTable_part2(result, start, maxrows, refreshmode)
                                }
                            } else {
                                getUDDHolderById(this.windowID).qbe = null;
                                var wargs = getWindowArgs_NS(this.windowID);
                                if (wargs != null && wargs.suppressNoMatch == true) {
                                    wargs.suppressNoMatch = false;
                                    throw new WorkflowException(this.windowID, 0, [])
                                } else {
                                    if (wargs != null && wargs.noMatchMessage != null) {
                                        var matchMsg = wargs.noMatchMessage;
                                        wargs.noMatchMessage = null;
                                        getCurWFC_NS(this.windowID).status([matchMsg]);
                                        throw new WorkflowException(this.windowID, 0, [])
                                    } else {
                                        getCurWFC_NS(this.windowID).status([{
                                            n: 9296,
                                            t: 1,
                                            m: null,
                                            a: null
                                        }]);
                                        throw new WorkflowException(this.windowID, 0, [])
                                    }
                                }
                            }
                            getUDDHolderById(this.windowID).qbe = null
                        }
                        dataWrapper.req = new NDXRequest();
                        dataWrapper.req.windowID = this.windowID;
                        this.AsyncGetQBETableEntryList(arg, dataWrapper, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), start, maxrows, qual, irid, ccid, encodedQual, loadEntryId, vuiId, search_label, search_ids, search_vals);
                        dataWrapper.req.showRunning();
                        weDisableStuff(this.windowID);
                        return {
                            i: 1
                        }
                    }
                },
                n: {
                    t: this,
                    f: function() {
                        if (("req" in dataWrapper) && ("result" in dataWrapper.req)) {
                            this.ShowMessageAfterLoadRL(dataWrapper.req)
                        }
                    }
                }
            }
        })
    } else {
        return this.RefreshTable( - 1, 0, false,
        function(start, maxrows) {
            var fieldids = [],
            fieldvals = [],
            fieldtypes = [];
            arg.ToArrays(fieldids, fieldvals, fieldtypes);
            req = new NDXGetQBETableEntryList(this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), ARKWGetStringByIdx(this.windowID, 17), this.mID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), start, maxrows, this.mSortOrder, qual.qual, qual.fieldids, qual.fieldvals, qual.fieldtypes, fieldids, fieldvals, fieldtypes, encodedQual, vuiId, loadEntryId, window.name, search_label, search_ids, search_vals, irid, ccid);
            this.ShowMessageAfterLoadRL(req);
            return req
        })
    }
};
DTable.prototype.ShowMessageAfterLoadRL = function(req) {
    if ("q" in req.result) {
        eval("this.mQual=" + req.result.q)
    }
    if (req.result.n == 0) {
        var wargs = getWindowArgs_NS(this.windowID);
        if (wargs != null && wargs.suppressNoMatch == true) {
            wargs.suppressNoMatch = false;
            throw new WorkflowException(this.windowID, 0, [])
        } else {
            if (wargs != null && wargs.noMatchMessage != null) {
                var matchMsg = wargs.noMatchMessage;
                wargs.noMatchMessage = null;
                getCurWFC_NS(this.windowID).status([matchMsg]);
                throw new WorkflowException(this.windowID, 0, [])
            } else {
                getCurWFC_NS(this.windowID).status([{
                    n: 9296,
                    t: 1,
                    m: null,
                    a: null
                }]);
                throw new WorkflowException(this.windowID, 0, [])
            }
        }
    }
};
DTable.prototype.Refresh = function(startrow, numrows, fromchunk, swc) {
    if (this.mID == 1020 && this.mNotRefreshed) {
        if (! (getARStateCurrent_NS(this.windowID) == 4) || getStateMgr_NS(this.windowID).InTransition()) {
            return
        }
        return {
            n: {
                f: FormAction_Query,
                a: [this.windowID]
            }
        }
    }
    var istack = [];
    if (this.mID == 1020) {
        istack.push({
            t: getStateMgr_NS(this.windowID),
            e: weDisplayWFException,
            f: getStateMgr_NS(this.windowID).ARStateChange,
            a: [this.windowID, this.mResultsListState]
        })
    }
    istack.push({
        f: this.RefreshTable,
        t: this,
        a: [startrow, numrows, fromchunk,
        function(start, maxrows, dataWrapper) {
            var server = this.mObj.getAttribute("arserver");
            server = ExpandServerName(this.windowID, server);
            var schema = this.mObj.getAttribute("arschema");
            schema = ExpandSchemaName(this.windowID, schema);
            if (this.mServer == "") {
                this.mServer = server
            }
            if (this.mSchema == "") {
                this.mSchema = schema
            }
            var qual;
            if (typeof this.mQual != "undefined") {
                qual = this.mQual
            } else {
                qual = this.mObj.getAttribute("arqual");
                eval("qual=" + qual)
            }
            var optimizeCall = false;
            if (this.mID != 1020) {
                optimizeCall = IsExternQualOptimizable(this.windowID, qual)
            }
            qual = ExpandQualifier(this.windowID, qual, schema, server, optimizeCall);
            if (!this.mUIInstantiated) {
                this.GetSortPreference()
            } else {
                if (this.mServer != server || this.mSchema != schema) {
                    this.ResetColData();
                    this.mServer = server;
                    this.mSchema = schema
                }
            }
            var irid = this.getImgRefIds();
            var ccid = this.getCColorIds();
            var encodedQual = "";
            if (ShowWaitCursor() && (typeof swc == "undefined")) {
                return {
                    isFromFunctionSplit: 1,
                    c: {
                        t: this,
                        f: function() {
                            dataWrapper.req = new NDXRequest();
                            dataWrapper.req.windowID = this.windowID;
                            if (this.mID == 1020) {
                                var search_label = "",
                                search_ids = [],
                                search_vals = [];
                                this.AsyncGetQBETableEntryList(null, dataWrapper, server, schema, start, maxrows, qual, irid, ccid, encodedQual, this.mPrimaryRowSelection, getForm_NS(this.windowID).currentFormVuiId, search_label, search_ids, search_vals)
                            } else {
                                dataWrapper.req.AsyncBC("GetTableEntryList", this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), ARKWGetStringByIdx(this.windowID, 17), this.mID, server, schema, ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), start, maxrows, this.mSortOrder, qual.qual, qual.fieldids, qual.fieldvals, qual.fieldtypes, qual.fieldexterns, optimizeCall, irid, ccid)
                            }
                            dataWrapper.req.showRunning();
                            weDisableStuff(this.windowID);
                            return {
                                i: 1
                            }
                        }
                    },
                    n: {
                        t: this,
                        f: function() {}
                    }
                }
            } else {
                if (this.mID == 1020) {
                    var fieldids = [],
                    fieldvals = [],
                    fieldtypes = [];
                    var search_label = "",
                    search_ids = [],
                    search_vals = [];
                    var entryToLoad = "-1";
                    if (this.mPrimaryRowSelection != null) {
                        entryToLoad = this.mPrimaryRowSelection
                    }
                    return new NDXGetQBETableEntryList(this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), ARKWGetStringByIdx(this.windowID, 17), this.mID, server, schema, ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), start, maxrows, this.mSortOrder, qual.qual, qual.fieldids, qual.fieldvals, qual.fieldtypes, fieldids, fieldvals, fieldtypes, encodedQual, getForm_NS(this.windowID).currentFormVuiId, entryToLoad, window.name, search_label, search_ids, search_vals, irid, ccid)
                } else {
                    return new NDXGetTableEntryList(this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), ARKWGetStringByIdx(this.windowID, 17), this.mID, server, schema, ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), start, maxrows, this.mSortOrder, qual.qual, qual.fieldids, qual.fieldvals, qual.fieldtypes, qual.fieldexterns, optimizeCall, irid, ccid)
                }
            }
        },
        swc]
    });
    return {
        n: istack
    }
};
DTable.prototype.AsyncGetQBETableEntryList = function(h, D, w, u, g, A, k, o, d, v, f, b, p, B, q) {
    var y = [],
    s = [],
    C = [];
    if (f == null) {
        f = "-1"
    }
    do {
        if (! (typeof(v) == "string")) {
            Assert('(Table.js:636) typeof(encodedQual) == "string"')
        }
    } while ( 0 );
    if (h) {
        h.ToArrays(y, s, C)
    }
    D.req.AsyncBC("GetQBETableEntryList", this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), ARKWGetStringByIdx(this.windowID, 17), this.mID, w, u, ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), g, A, this.mSortOrder, k.qual, k.fieldids, k.fieldvals, k.fieldtypes, y, s, C, v, b, f, window.name, p, B, q, o, d)
};
DTable.prototype.IsRefreshed = function() {
    return ! this.mNotRefreshed
};
DTable.prototype.RefreshTable = function(u, h, f, y, k) {
    var d, p, g = null;
    var v = parseInt(this.mObj.getAttribute("arselrefresh"));
    if (f || this.mNotRefreshed || (v != 0 && v != 1)) {
        this.ClearSelections(true)
    }
    if (this.mChunkSize > 0) {
        if (this.mResult) {
            var b = Math.ceil(this.mResult.n / this.mChunkSize);
            if (this.mChunkPage >= b) {
                this.mChunkPage = b - 1
            }
        }
        if (this.mChunkPage < 0) {
            this.mChunkPage = 0
        }
        d = (u >= 0) ? u: this.mChunkPage * this.mChunkSize;
        p = (h > 0) ? h: this.mChunkSize
    } else {
        d = (u >= 0) ? u: 0;
        p = (h > 0) ? h: parseInt(this.mObj.getAttribute("armaxrows"))
    }
    if (this.mNotRefreshed && this.mSortOrder.length == 0) {
        var q = this.GetInitialRowSortOrder();
        if (q != null) {
            this.RebuildSortOrder(q.col, q.dir)
        }
    }
    if (ShowWaitCursor() && (typeof k == "undefined")) {
        var o = {};
        return {
            isFromFunctionSplit: 1,
            c: {
                t: this,
                f: function() {
                    var A = y.call(this, d, p, o);
                    if (A.result) {
                        o.req = A
                    } else {
                        return A
                    }
                }
            },
            n: {
                t: this,
                f: function() {
                    if (("req" in o) && ("result" in o.req)) {
                        var A = o.req.result;
                        if (A == null) {
                            return
                        }
                        return this.RefreshTable_part2(A, d, p, v)
                    }
                }
            }
        }
    } else {
        var s = y.call(this, d, p);
        var w = s.result;
        return this.RefreshTable_part2(w, d, p, v)
    }
};
DTable.prototype.TriggerEventRefresh = function() {
    if (this.mID != 1020) {
        if (!getCurWFC_NS(this.windowID)) {
            promptBar.setToClear()
        }
        return ExecuteWorkflow(this.windowID, 2097152, this.mID)
    }
};
DTable.prototype.RefreshTable_part2 = function(C, d, p, y) {
    if (C.start != null) {
        d = C.start
    }
    if (this.mID == 1020) {
        if (C.n > g && g < this.mChunkSize && C.n != (d + p)) {
            this.mChunkSize = g
        }
    }
    if (this.mChunkSize > 0) {
        this.mChunkPage = Math.ceil(d / this.mChunkSize);
        if (this.mChunkOuter != null) {
            this.UpdateChunkUI(C)
        }
    }
    if (C.n < d + p) {
        p = C.n - d
    }
    var g = C.r.length;
    if (p <= 0) {
        p = g
    }
    this.mResult = C;
    this.mLastRefreshTime = new Date().getTime();
    ARKWSetLASTCOUNT(this.windowID, C.n);
    var h = this.mResult.idmap;
    for (var k in this.mRowSelections) {
        if (! (k in h)) {
            delete this.mRowSelections[k]
        }
    }
    if (this.mPrimaryRowSelection != null && (!(this.mPrimaryRowSelection in h))) {
        this.mPrimaryRowSelection = null
    }
    this.mARRowSelection = this.mPrimaryRowSelection == null ? 0 : this.RowNoFromTag(this.mPrimaryRowSelection) + 1;
    this.mLastNonShiftedRowSelection = this.mLastRowSelection = this.mARRowSelection - 1;
    this.SetRow(this.mARRowSelection - 1);
    var w = this.mObj.getAttribute("arcoledit");
    for (var k = 0; k < this.mColCnt; ++k) {
        if (w != null) {
            if (w.charAt(k) == "1") {
                if (C.f[k].t.indexOf("Enum") == -1) {
                    this.mColInfo[k].edit = 2
                } else {
                    if (C.f[k].et == 2) {
                        this.mColInfo[k].edit = 3;
                        var b = C.f[k].e;
                        for (var g in b) {
                            this.mColInfo[k].mEnumLabel = b[g];
                            this.mColInfo[k].mEnumValue = g;
                            break
                        }
                    } else {
                        this.mColInfo[k].edit = 1
                    }
                }
            } else {
                if (w.charAt(k) == "2") {
                    if (C.f[k].t.indexOf("Char") != -1 && C.f[k].m != null) {
                        this.mColInfo[k].edit = 1
                    }
                } else {
                    this.mColInfo[k].edit = 0
                }
            }
        }
        if ("dLen" in C.f[k]) {
            this.mColInfo[k].dLen = C.f[k].dLen
        }
    }
    var f = this.mObj.getAttribute("arserver");
    f = ExpandServerName(this.windowID, f);
    if (f != ARKWGetStringByIdx(this.windowID, 7)) {
        for (var B = 0; B < this.mColCnt; B++) {
            if (C.f[B].t.indexOf("Char") != -1 && C.f[B].m != null && (this.mColInfo[B].edit == 1)) {
                var o = C.f[B].m;
                var u = ARMenu_Get(this.windowID, o, f)
            }
        }
    }
    for (var k = 0; k < this.mColFields.length; ++k) {
        this.mColFields[k].Refresh()
    }
    this.mAsyncDirty = (3 > this.mAsyncDirty ? 3 : this.mAsyncDirty);
    var v = this.mObj.getAttribute("arentretstr");
    var A = C.r.length;
    if (v != "" && v != null) {
        v = v.replace(/\{0\}/, (A == 0 ? 0 : d + 1));
        v = v.replace(/\{1\}/, (A == 0 ? 0 : d + A));
        v = v.replace(/\{2\}/, A);
        v = v.replace(/\{3\}/, C.n)
    } else {
        if (v == null) {
            v = ""
        }
    }
    this.mAsyncQueue.push({
        action: 2,
        val: v,
        cval: this.mChunkPage + 1
    });
    if (this instanceof DTreeView) {
        this.BuildTree()
    }
    if (this.mNotRefreshed) {
        this.mNotRefreshed = false;
        if (this.GetData().length > 0) {
            if (this.mMode != 2) {
                if (this.mMode == 0) {
                    return {
                        c: {
                            t: this,
                            f: this.SetPrimarySelection,
                            a: [0, true, false, true]
                        },
                        n: {
                            t: this,
                            f: this.TriggerEventRefresh
                        }
                    }
                } else {
                    return {
                        c: {
                            t: this,
                            f: this.SetPrimarySelection,
                            a: [0, false, false, true]
                        },
                        n: {
                            t: this,
                            f: this.TriggerEventRefresh
                        }
                    }
                }
            } else {
                return {
                    n: {
                        t: this,
                        f: this.TriggerEventRefresh
                    }
                }
            }
        } else {
            return {
                n: {
                    t: this,
                    f: this.TriggerEventRefresh
                }
            }
        }
    } else {
        if (this.GetData().length > 0) {
            if (y == 2) {
                return {
                    c: {
                        t: this,
                        f: this.S,
                        a: [new IntegerType(1)]
                    },
                    n: {
                        t: this,
                        f: this.TriggerEventRefresh
                    }
                }
            } else {
                if (y == 3) {
                    return {
                        c: {
                            t: this,
                            f: this.S,
                            a: [new IntegerType( - 1)]
                        },
                        n: {
                            t: this,
                            f: this.TriggerEventRefresh
                        }
                    }
                } else {
                    if (y == 0) {
                        var q = this.GetRow();
                        this.SetRow(this.mARRowSelection - 1);
                        if (q >= this.GetData().length) {
                            q = -1
                        }
                        this.SetRow(q);
                        if (this.GetRow() > -1) {
                            return {
                                c: {
                                    f: ExecuteWorkflow,
                                    a: [this.windowID, 128, this.mID]
                                },
                                n: {
                                    t: this,
                                    f: this.TriggerEventRefresh
                                }
                            }
                        }
                        return {
                            n: {
                                t: this,
                                f: this.TriggerEventRefresh
                            }
                        }
                    } else {
                        return {
                            n: {
                                t: this,
                                f: this.TriggerEventRefresh
                            }
                        }
                    }
                }
            }
        } else {
            return {
                n: {
                    t: this,
                    f: this.TriggerEventRefresh
                }
            }
        }
    }
};
DTable.prototype.UpdateChunkUI = function(b) {
    var d = Math.ceil(b.n / this.mChunkSize);
    if (d == 1) {
        this.mChunkPrevBtn.style.visibility = "hidden";
        this.mChunkNextBtn.style.visibility = "hidden"
    } else {
        if (this.mChunkPage == 0) {
            this.mChunkPrevBtn.style.visibility = "hidden";
            this.mChunkNextBtn.style.visibility = "inherit"
        } else {
            if (this.mChunkPage == d - 1) {
                this.mChunkPrevBtn.style.visibility = "inherit";
                this.mChunkNextBtn.style.visibility = "hidden"
            } else {
                this.mChunkPrevBtn.style.visibility = "inherit";
                this.mChunkNextBtn.style.visibility = "inherit"
            }
        }
    }
};
DTable.prototype.Report = function() {
    if (!this.mResult) {
        return
    }
    ReportSelForm = decodeURIComponent(ReportSelForm);
    var reportConsole = false;
    if (ReportConsoleForm != null && ReportConsoleForm.length > 0) {
        ReportConsoleForm = decodeURIComponent(ReportConsoleForm);
        reportConsole = true
    }
    var inmap = {};
    var val;
    var schema = this.mObj.getAttribute("arschema");
    schema = ExpandSchemaName(this.windowID, schema);
    val = new CharType(schema);
    inmap[(reportConsole == true) ? 93992 : 2000035] = {
        t: val.type,
        v: val.toPrimitive(),
        a: val.args()
    };
    var server = this.mObj.getAttribute("arserver");
    server = ExpandServerName(this.windowID, server);
    val = new CharType(server);
    inmap[(reportConsole == true) ? 93296 : 2000036] = {
        t: val.type,
        v: val.toPrimitive(),
        a: val.args()
    };
    var qual;
    if (typeof this.mQual != "undefined") {
        qual = this.mQual
    } else {
        qual = this.mObj.getAttribute("arqual");
        eval("qual=" + qual)
    }
    qual = ExpandQualifier(this.windowID, qual, schema, server);
    if (qual.qual != "" && qual.fieldids.length > 0) {
        var req = new NDXParseAndEvaluateQualifier(this.windowID, server, schema, "", qual.qual, qual.fieldids, qual.fieldvals, qual.fieldtypes);
        qual = {
            qual: req.result,
            fieldids: [],
            fieldvals: [],
            fieldtypes: []
        }
    }
    val = new CharType(qual.qual);
    inmap[(reportConsole == true) ? 93289 : 2000037] = {
        t: val.type,
        v: val.toPrimitive(),
        a: val.args()
    };
    var ids = this.GetSelectedRowsByEntryId();
    var entryIDS = [];
    if (ids.length > 0 && ids.length < this.mResult.n) {
        entryIDS.push(ids[0]);
        for (var i = 1; i < ids.length; i++) {
            entryIDS.push(",");
            entryIDS.push(ids[i])
        }
    }
    if (entryIDS.length > 0) {
        val = new CharType(entryIDS.join(""));
        inmap[(reportConsole == true) ? 93291 : 2000038] = {
            t: val.type,
            v: val.toPrimitive(),
            a: val.args()
        }
    }
    val = new CharType(schema);
    inmap[(reportConsole == true) ? 93297 : 2000050] = {
        t: val.type,
        v: val.toPrimitive(),
        a: val.args()
    };
    var reportServer = server;
    var temp = ARPrefsGetAsString(24002);
    if (temp != null && temp.length > 0) {
        var semicolonIndex = temp.indexOf(";");
        if (semicolonIndex < 0) {
            reportServer = temp
        } else {
            if (semicolonIndex > 0) {
                reportServer = temp.substring(0, semicolonIndex)
            }
        }
    }
    return ARACTOpenDialog(this.windowID, reportServer, (reportConsole == true) ? ReportConsoleForm: ReportSelForm, "", 1, inmap, null, null, null)
};
DTable.prototype.NextChunk = function(b) {
    if (this.mChunkSize == 0) {
        return
    }
    this.mChunkPage += b;
    return {
        n: {
            t: this,
            f: this.Refresh,
            a: [ - 1, 0, true]
        }
    }
};
DTable.prototype.SelectAll = function(f) {
    var d = [];
    d.push({
        t: this,
        f: function() {
            this.mAsyncDirty = (2 > this.mAsyncDirty ? 2 : this.mAsyncDirty)
        }
    });
    if (f) {
        var b = this.mPrimaryRowSelection;
        d.push({
            t: this,
            f: function() {
                if (this.mID == 1020) {
                    formEnableStuff(this.windowID)
                }
                if (this.mPrimaryRowSelection != null) {
                    this.SetRow(this.RowNoFromTag(this.mPrimaryRowSelection))
                }
                if (this.mPrimaryRowSelection != null && this.mPrimaryRowSelection != b) {
                    this.mARRowSelection = (b != null) ? this.RowNoFromTag(b) + 1 : this.RowNoFromTag(this.mPrimaryRowSelection) + 1;
                    return {
                        n: {
                            t: this,
                            a: [true, true, b],
                            f: this.ARRowSelected
                        }
                    }
                }
            }
        });
        d.push({
            t: this,
            f: this.FillAllSelections
        })
    } else {
        d.push({
            t: this,
            f: function() {
                this.mLastRowSelection = this.mLastNonShiftedRowSelection = -1;
                this.ClearSelections(true);
                this.SetRow( - 1);
                if (this.mID == 1020) {
                    Field_Clear(this.windowID, true);
                    Field_ClearChanged(this.windowID);
                    formDisableStuff(this.windowID)
                }
            }
        })
    }
    if (this.colCheck == 1) {
        d.push({
            t: this,
            a: [f],
            f: this.checkSelDeselall
        })
    }
    return {
        n: d
    }
};
DTable.prototype.Preferences = function(b, f) {
    var d = new TableSettingsMenu(f);
    return {
        n: {
            f: d.Open,
            a: [b, 3],
            t: d
        }
    }
};
DTable.prototype.MarkRead = function(b) {};
DTable.prototype.GetRowSelected = function(b) {
    b = this.TagFromRowNo(b);
    if (this.mPrimaryRowSelection != null && b == this.mPrimaryRowSelection) {
        return 2
    } else {
        if (this.mRowSelections[b]) {
            return 1
        }
    }
    return 0
};
DTable.prototype.GetRowState = function(d) {
    var b = this.mResult.r[d].mXXXDirty;
    if (typeof b == "undefined") {
        return 0
    }
    return b
};
DTable.prototype.SetRowState = function(h, f) {
    if (this.mResult == undefined) {
        return
    }
    if (h < -1 || h >= this.GetData().length) {
        return
    }
    var g = false;
    if (h == -1) {
        var b = this.GetData().length;
        for (var d = 0; d < b; ++d) {
            if (!g && this.mResult.r[d].mXXXDirty != undefined && f != this.mResult.r[d].mXXXDirty) {
                if (this.mResult.r[d].mXXXDirty == 2 && f == 3 || this.mResult.r[d].mXXXDirty == 3 && f == 2) {
                    g = true
                }
            }
            this.mResult.r[d].mXXXDirty = f
        }
    } else {
        if (!g && this.mResult.r[h].mXXXDirty != undefined && f != this.mResult.r[h].mXXXDirty) {
            if (this.mResult.r[h].mXXXDirty == 2 && f == 3 || this.mResult.r[h].mXXXDirty == 3 && f == 2) {
                g = true
            }
        }
        this.mResult.r[h].mXXXDirty = f
    }
    if (g) {
        this.mAsyncDirty = (3 > this.mAsyncDirty ? 3 : this.mAsyncDirty)
    }
};
DTable.prototype.GetRows = function() {
    return this.GetData().length
};
DTable.prototype.GetSelectedRows = function() {
    var d = [];
    for (var b in this.mRowSelections) {
        d.push(this.RowNoFromTag(b))
    }
    d.sort(function(f, g) {
        return (f - g)
    });
    return d
};
DTable.prototype.SetRow = function(d) {
    this.mCurrentRow = d;
    this.mARRowSelection = d + 1;
    if (d == -1) {
        for (var b = 0; b < this.mColFields.length; ++b) {
            this.mColFields[b].Update(null, null)
        }
    } else {
        for (var b = 0; b < this.mColFields.length; ++b) {
            this.mColFields[b].Update(this.mResult.r[d].d[b], this.mResult.r[d].i)
        }
    }
};
DTable.prototype.GetRow = function() {
    return this.mCurrentRow
};
DTable.prototype.DataChanged = function() {
    this.mAsyncDirty = (3 > this.mAsyncDirty ? 3 : this.mAsyncDirty)
};
DTable.prototype.G = function() {
    if (this.mARRowSelection == null) {
        return Null
    }
    return new IntegerType(this.mCurrentRow + 1)
};
DTable.prototype.DoSet = DTable.prototype.DoSLoadEntry = function(g) {
    if (g instanceof Datatype) {
        g = g.toInteger()
    } else {
        if (g == "") {
            g = 0
        } else {
            g = parseInt(g)
        }
    }
    var h = true;
    var b = true;
    if (g < 0) {
        g = -g;
        h = false
    }
    if (g > 100000000) {
        g -= 100000000;
        b = false
    }
    var d = this.GetData().length;
    if (g > d) {
        g = 0;
        h = false;
        b = true
    }
    if (g == 0) {
        this.ClearSelections(true);
        this.mAsyncDirty = (2 > this.mAsyncDirty ? 2 : this.mAsyncDirty)
    } else {
        if (this.mARRowSelection == g) {
            return
        }
        if (b) {
            return {
                c: {
                    f: this.SetPrimarySelection,
                    t: this,
                    a: [g - 1, h, true, true]
                },
                n: {
                    t: this,
                    f: function() {
                        this.mAsyncDirty = (2 > this.mAsyncDirty ? 2 : this.mAsyncDirty)
                    }
                }
            }
        } else {
            var f = this.GetRow();
            getCurWFC_NS(this.windowID).AddCallback(this,
            function(k) {
                if (k >= this.GetData().length) {
                    k = -1
                }
                this.SetRow(k)
            },
            [f]);
            this.SetRow(g - 1);
            if (h) {
                return {
                    n: {
                        f: ExecuteWorkflow,
                        a: [this.windowID, 128, this.mID]
                    }
                }
            }
        }
    }
};
DTable.prototype.GetHoverValue = function(b) {
    if (this.mARRowSelection == null) {
        return ""
    }
    var d = this.mCurrentRow + 1;
    return d + ""
};
DTable.prototype.GDefault = function() {
    return null
};
DTable.prototype.Clear = function() {
    if (this.mNotRefreshed) {
        return
    }
    delete this.mResult;
    delete this.mResultsListState;
    if (this.mRowsPresent > 0 && typeof this.mInner != "undefined") {
        this.mInner.innerHTML = ""
    }
    this.SetRow( - 1);
    this.ClearSelections(true);
    this.mAsyncDirty = (3 > this.mAsyncDirty ? 3 : this.mAsyncDirty);
    var b = this.mObj.getAttribute("arnotrefstr");
    if (b == null) {
        b = ""
    }
    this.mAsyncQueue.push({
        action: 2,
        val: b,
        cval: 0
    });
    this.mNotRefreshed = true
};
DTable.prototype.FlushAsyncQueue = function() {
    if (!this.mAsyncDirty) {
        return
    }
    if (!this.mUIInstantiated) {
        this.InstantiateUI();
        this.SetDefaultSizesAndOrder();
        var b = gettablePrefs_NS(this.windowID);
        if (b != null && typeof b.interval[this.mID] != "undefined") {
            this.mRefreshInterval = b.interval[this.mID];
            ARRegisterTableRefreshInterval(this.windowID, this, this.mRefreshInterval)
        }
    }
    var f = false;
    try {++this.mFlushingQueue;
        while (this.mAsyncQueue.length) {
            var d = this.mAsyncQueue.shift();
            if (d.action == 0) {
                this.mColFields[d.col].UpdateLabel(d.val)
            } else {
                if (d.action == 1) {
                    this.mColFields[d.col].UpdateVis(d.val);
                    f = true
                } else {
                    if (d.action == 2) {
                        if (this.mHdrLObj != null) {
                            this.mHdrLObj.innerHTML = d.val.HTMLEncode();
                            var h = DTable.superclass.MakeTableTitle.call(this, d.val);
                            if (this.mHasHoverEvt) {
                                h = ""
                            }
                            if (this.mDataTableObj) {
                                this.mDataTableObj.title = h
                            }
                        }
                        if (this.mChunkInput != null) {
                            this.mChunkInput.value = d.cval
                        }
                    }
                }
            }
        }
        if (this.mAsyncResizePending) {
            this.DoResize(this.mAsyncResizePending.w, this.mAsyncResizePending.h)
        }
        if (f && !this.mHScroll) {
            this.ScaleSizes()
        }
        if (this.mAsyncDirty >= 3) {
            if (this instanceof DTreeView) {
                this.BuildTree()
            }
            this.ApplyData()
        } else {
            if (this.mAsyncDirty >= 2) {
                this.ApplySelections(true, false)
            }
        }
        this.mAsyncDirty = 0;
        this.mAsyncResizePending = null
    } finally {--this.mFlushingQueue;
        var g = F(this.windowID, this.mParentField);
        while (g) {
            if (g instanceof DPage && g.mFillModel && g.mState == 1 && g.mFit) {
                g.getChildScroll(this)
            }
            g = g.GetParent()
        }
    }
};
DTable.prototype.UpdateAccess = function(b) {
    if (this.mGroup && !this.mNotRefreshed) {
        this.ApplyData()
    }
};
DTable.prototype.SColLabel = function(b, d) {
    if (this.mFlushingQueue > 0) {
        DTable.superclass.SColLabel.call(this, b, d)
    } else {
        this.mColInfo[b].heading = d;
        this.mAsyncQueue.push({
            action: 0,
            col: b,
            val: d
        });
        this.mAsyncDirty = (3 > this.mAsyncDirty ? 3 : this.mAsyncDirty)
    }
};
DTable.prototype.SColVis = function(b, d) {
    if (this.mFlushingQueue > 0) {
        DTable.superclass.SColVis.call(this, b, d)
    } else {
        this.mAsyncQueue.push({
            action: 1,
            col: b,
            val: d
        });
        this.mAsyncDirty = (3 > this.mAsyncDirty ? 3 : this.mAsyncDirty)
    }
};
function DTable_DoEntryChange(d, h) {
    var b = [];
    var f = getTableFields_NS(d);
    for (var g = 0; g < f.length; ++g) {
        if (f[g].mObj.getAttribute("arautorefresh") && ARPrefsGetAsNumber(20119) == 1 && (h == 0)) {
            if (ExpandServerName(d, f[g].mObj.getAttribute("arserver")).length > 0 && ExpandSchemaName(d, f[g].mObj.getAttribute("arschema")).length > 0) {
                b.push({
                    t: f[g],
                    f: DTable.prototype.Refresh,
                    a: [ - 1, 0, false]
                })
            }
        } else {
            if ((h == 1) && f[g].mID != 1020) {
                f[g].Clear()
            }
        }
    }
    if (b.length > 0) {
        return getCurWFC_NS(d).executeAll(b)
    }
}
DTable.prototype.Snapshot = function(f, d, b) {
    var g = DTable.superclass.Snapshot.call(this, f, d, b);
    if (g.d) {
        g.d = "" + ( - g.d)
    }
    return g
};
DTable.prototype.RebuildSortOrder = function(f, d) {
    if (this.mGroup) {
        this.mSortOrder = [this.mGroupOrder[0], this.mGroupOrder[1]];
        if (f != -2) {
            this.mSortOrder.push(f);
            this.mSortOrder.push(d)
        }
        return
    }
    var b = this.mObj.getAttribute("arsort");
    if (f == -2) {
        this.mSortOrder = []
    } else {
        this.mSortOrder = [f, d]
    }
    if (b != "") {
        var h = b.split(",");
        for (var g = 0; g < h.length; g += 2) {
            var o = parseInt(h[g]);
            if (o != f) {
                var k = parseInt(h[g + 1]);
                this.mSortOrder.push(o);
                this.mSortOrder.push(k)
            }
        }
    }
};
DTable.prototype.GetSelectedRowsByEntryId = function() {
    var b = [];
    for (var d in this.mRowSelections) {
        b.push(d)
    }
    return b
};
DTable.prototype.DeleteSelected = function() {
    var d = this.GetSelectedRowsByEntryId();
    if (d.length == 0) {
        return
    }
    var f;
    if (d.length == 1) {
        f = getLocalizedMessage("{0} entry selected for deletion", [d.length])
    } else {
        f = getLocalizedMessage("{0} entries selected for deletion", [d.length])
    }
    var b = {};
    return {
        c: {
            f: ConfirmPopup,
            a: [this.windowID, f, b, 2 | 1]
        },
        n: {
            t: this,
            f: function() {
                if (("v" in b.result) && b.result.v == 1) {
                    var u = this.mObj.getAttribute("arserver");
                    u = ExpandServerName(this.windowID, u);
                    var q = this.mObj.getAttribute("arschema");
                    q = ExpandSchemaName(this.windowID, q);
                    var s = null;
                    var g = null;
                    for (var o = 0; o < this.mResult.r.length; o++) {
                        s = this.mResult.r[o].i;
                        var k = false;
                        for (var h = 0; h < d.length; h++) {
                            if (d[h] == s) {
                                k = true;
                                break
                            }
                        }
                        if (!k) {
                            g = s;
                            break
                        }
                    }
                    var p = new NDXDeleteEntry(this.windowID, u, q, d);
                    this.mPrimaryRowSelection = g;
                    this.mARRowSelection = this.mPrimaryRowSelection == null ? 0 : this.RowNoFromTag(this.mPrimaryRowSelection) + 1;
                    this.mLastNonShiftedRowSelection = this.mLastRowSelection = this.mARRowSelection - 1;
                    this.mRowSelections = [];
                    if (null != this.mPrimaryRowSelection) {
                        this.mRowSelections[this.mPrimaryRowSelection] = true
                    }
                    return this.Refresh(0, 0, false)
                }
            }
        }
    }
};
DTable.prototype.Resort = function(d, b) {
    this.RebuildSortOrder(d, b);
    this.mChunkPage = 0;
    return this.Refresh( - 1, 0, false)
};
DTable.prototype.ApplyData = function() {
    DTable.superclass.ApplyData.call(this);
    var f = (this.GetData().length > 0);
    if (this.mBtnReport) {
        this.mBtnReport.SetVisibility(f)
    }
    if (this.mBtnSelectAll) {
        this.mBtnSelectAll.SetVisibility(f)
    }
    if (this.mBtnDeselectAll) {
        this.mBtnDeselectAll.SetVisibility(f)
    }
    if (this.mBtnDelete) {
        this.mBtnDelete.SetVisibility(f)
    }
    if (this.mBtnRead) {
        this.mBtnRead.SetVisibility(f)
    }
    if (this.mBtnUnread) {
        this.mBtnUnread.SetVisibility(f)
    }
    if (this.mChunkOuter) {
        this.mChunkOuter.style.visibility = (f ? "inherit": "hidden")
    }
    var d = this.windowID;
    if (FocusMgr.mCurFocusID == this.mID && FocusMgr.mCurFocusElement != null) {
        setTimeout(function() {
            FocusMgr.TryFocus(d, FocusMgr.mCurFocusElement)
        },
        0)
    }
    if (this.mGroup && !this.mNotRefreshed) {
        if (this.GAccess() == 3) {
            $("#T" + this.mID).treeTable({
                clickableNodeNames: true,
                initialState: "collapsed",
                expandable: false,
                indent: 15
            })
        } else {
            $("#T" + this.mID).treeTable({
                clickableNodeNames: true,
                initialState: "collapsed",
                indent: 15
            });
            if (this.mFolderStatus != null && this.mFolderStatus.length > 0) {
                this.restoreAllFolderStatus(this.mFolderStatus)
            } else {
                if (this.mPrimaryRowSelection != null) {
                    primrowno = this.RowNoFromTag(this.mPrimaryRowSelection);
                    var g = this.FishOutTR(primrowno);
                    while (g && g.previousSibling) {
                        g = g.previousSibling;
                        if (g && (g.className.indexOf("parent") >= 0 || g.className.indexOf("emptyGroup") >= 0)) {
                            var b = g.getAttribute("id");
                            $("#T" + this.mID + " #" + b).expand();
                            g = null
                        }
                    }
                }
            }
        }
    }
};
DTable.prototype.ARRowSelected = function(g, f, d, o) {
    this.SetRow(this.mARRowSelection - 1);
    if (this.mGroup && !this.mNotRefreshed) {
        if (this.mPrimaryRowSelection != null) {
            primrowno = this.RowNoFromTag(this.mPrimaryRowSelection);
            var k = this.FishOutTR(primrowno);
            while (k && k.previousSibling) {
                k = k.previousSibling;
                if (k && (k.className.indexOf("parent") >= 0 || k.className.indexOf("emptyGroup") >= 0)) {
                    var h = k.getAttribute("id");
                    $("#T" + this.mID + " #" + h).expand();
                    k = null
                }
            }
        }
    }
    var b = [];
    if (g && !o) {
        b.push({
            f: ExecuteWorkflow,
            a: [this.windowID, 128, this.mID]
        })
    }
    if (this.mID == 1020 && f) {
        this.mPrevARSelection = d;
        b.push({
            t: getStateMgr_NS(this.windowID),
            f: getStateMgr_NS(this.windowID).ARStateChange,
            a: [this.windowID, this.mResultsListState]
        })
    }
    return {
        n: b
    }
};
DTable.prototype.RestoreResultsListToPrevSelection = function() {
    if (this.mPrevARSelection == null || this.mPrevARSelection == 0) {
        return {
            n: {
                t: this,
                f: this.ClearSelections,
                a: [true]
            }
        }
    } else {
        return {
            n: {
                t: this,
                f: this.SetPrimarySelection,
                a: [this.mPrevARSelection - 1, false, false, true]
            }
        }
    }
};
DTable.prototype.ARRowCleared = function() {
    this.SetRow( - 1)
};
DTable.prototype.ARDrillDown = function(f, g) {
    if (!this.mObj.getAttribute("ardrill")) {
        return ExecuteWorkflow(this.windowID, 2, this.mID)
    }
    var b = this.mResult.r[f.y].i;
    var d = "";
    if (this.mID == 1020) {
        d = ARKWGetStringByIdx(this.windowID, 17)
    }
    return {
        n: [{
            f: function(h) {
                return OpenNonModalForm(h.windowID, 1, ExpandServerName(h.windowID, h.mObj.getAttribute("arserver")), ExpandSchemaName(h.windowID, h.mObj.getAttribute("arschema")), d, {
                    fvlist: null,
                    wMode: 99,
                    wForceClear: 1,
                    qual: {
                        qual: "4\\1\\1\\1\\2\\4\\" + b.length + "\\" + b + "\\",
                        fieldids: [],
                        fieldvals: [],
                        fieldtypes: []
                    }
                })
            },
            a: [this]
        },
        {
            f: ExecuteWorkflow,
            a: [this.windowID, 2, this.mID]
        }]
    }
};
DTable.prototype.GetColumnInfo = function() {
    return this.mColInfo
};
DTable.prototype.GetInitialColumnWidths = function() {
    if (this.mObj.getAttribute("arcolws") == "") {
        return []
    }
    var d = this.mObj.getAttribute("arcolws").split(",");
    for (var b = 0; b < d.length; ++b) {
        d[b] = parseInt(d[b])
    }
    return d
};
DTable.prototype.GetData = function() {
    if (this.mResult) {
        return this.mResult.r
    } else {
        return []
    }
};
DTable.prototype.TagFromRowNo = function(b) {
    return this.mResult.r[b].i
};
DTable.prototype.RowNoFromTag = function(b) {
    return this.mResult.idmap[b]
};
DTable.prototype.SetRowSortOrder = function(d, b) {};
DTable.prototype.GetInitialRowSortOrder = function() {
    var b = this.mObj.getAttribute("arsort");
    if (b != "") {
        var d = b.split(",");
        return {
            col: parseInt(d[0]),
            dir: parseInt(d[1])
        }
    }
    return null
};
DTable.prototype.GetRowColours = function() {
    if (this.mObj.getAttribute("arcolours")) {
        return this.mObj.getAttribute("arcolours").split("|")
    }
};
DTable.prototype.GetBkgRowColours = function() {
    if (this.mObj.getAttribute("arbkgcolours")) {
        return this.mObj.getAttribute("arbkgcolours").split("|")
    }
};
DTable.prototype.GetAtBottom = function() {
    return this.mObj.getAttribute("arbottom") != null
};
DTable.prototype.getScrollheight = function() {
    var b = 0;
    var d;
    if (this.mParent) {
        if (this.mFixedHeader) {
            d = this.mParent.firstChild.childNodes[1]
        } else {
            d = this.mParent.firstChild.firstChild
        }
    }
    if (d.scrollHeight > d.offsetHeight) {
        b = d.scrollHeight - d.offsetHeight
    }
    return b
};
DTable.prototype.getScrollwidth = function() {
    var b = 0;
    var d = this.mParent.firstChild.firstChild;
    if (d.scrollWidth > d.offsetWidth) {
        b = d.scrollWidth - d.offsetWidth
    }
    return b
};
DTable.prototype.SetDefaultSizesAndOrder = function() {
    var q = this.mColDatas,
    g = this.GetInitialColumnWidths(),
    b = this.mColFields;
    var h = gettablePrefs_NS(this.windowID);
    for (var k = 0; k < this.mColCnt; ++k) {
        var f = b[q[k].mDataCol].mID;
        if (h != null && f in h.colWs) {
            q[k].mWidth = h.colWs[f]
        } else {
            q[k].mWidth = (g[k] < 5 ? 5 : g[k])
        }
        if (k == this.mColCnt - 1 && this.mHScroll && q[k].mWidth > 5 * 2) {
            q[k].mWidth -= 5
        }
    }
    this.GetSortPreference();
    var p = {};
    for (var k = 0; k < this.mColCnt; k++) {
        p[b[q[k].mDataCol].mID] = q[k]
    }
    if (h != null && this.mID in h.colOrd) {
        var s = [];
        var o = h.colOrd[this.mID];
        for (var u = 0; u < o.length; u++) {
            var d = o[u];
            if (d in p) {
                s.push(p[d]);
                delete p[d]
            }
        }
        if (s.length > 0) {
            for (var d in p) {
                p[d].mWidth = 0;
                s.splice(p[d].mDataCol, 0, p[d])
            }
            this.mColDatas = s
        }
    }
};
DTable.prototype.GetSortPreference = function() {
    var h = gettablePrefs_NS(this.windowID);
    if (h != null && this.mID in h.colSort) {
        var b = this.mColFields,
        u = this.mColDatas,
        s = {},
        f = [];
        for (var p = 0; p < this.mColCnt; p++) {
            s[b[u[p].mDataCol].mID] = u[p]
        }
        var q = h.colSort[this.mID];
        for (var o = 0; o < q.length; o += 2) {
            var d = s[q[o]];
            if (!d) {
                if (this.mID == 1020) {
                    for (var g = 0; g < this.mColCnt; g++) {
                        if (b[u[g].mDataCol].mObj.fid == q[o]) {
                            d = u[g];
                            break
                        }
                    }
                }
            }
            if (d) {
                f[o] = d.mDataCol;
                f[o + 1] = q[o + 1];
                if (o == 0) {
                    d.mPrimarySort = true;
                    d.mSortDir = q[o + 1]
                }
            }
        }
        this.mSortOrder = f
    }
};
DTable.prototype.ClearSelections = function(b) {
    DTable.superclass.ClearSelections.call(this, b);
    if (this.mFtrRObj && this.mID == 1020) {
        var d = getLocalizedMessage("{0} rows selected");
        d = d.replace(/\{0\}/, 0);
        NodeWrite(this.mFtrRObj, d)
    }
};
DTable.prototype.getTemplateForField = function(b) {
    return this.mColFields[b].mObj.btemplate
};
DTable.prototype.getTemplateHeightForField = function(b) {
    return this.mColFields[b].mObj.ht
};
DTable.prototype.getFieldIDForColumn = function(d) {
    var b = this.MapUIXToData(d);
    if (b == null) {
        return
    }
    return this.mColFields[b].mID
};
DTable.prototype.hasImgRefs = function() {
    for (var b = 0; b < this.mColFields.length; b++) {
        if (this.mColFields[b].hasImgRef()) {
            return true
        }
    }
    return false
};
DTable.prototype.hasVisImgRefs = function() {
    for (var d = 0; d < this.mColCnt; ++d) {
        if (this.mColDatas[d].mVisible) {
            var b = this.mColFields[d];
            if (b.hasImgRef()) {
                return true
            }
        }
    }
    return false
};
DTable.prototype.imgHtml = function(d, b, g) {
    var f = '<img class="irTbl" src=' + d.HTMLEncode() + " alt=";
    if (b == null) {
        f += '""'
    } else {
        f += '"' + b.HTMLEncode() + '"'
    }
    f += " title=";
    if (b == null) {
        f += '""'
    } else {
        f += '"' + b.HTMLEncode() + '"'
    }
    if (g != null && g.length > 0) {
        f += ' id="' + g + '"'
    }
    f += ">&nbsp;";
    return f
};
DTable.prototype.getVisImgRefs = function(u, d) {
    if (!this.hasVisImgRefs()) {
        return []
    }
    var p = [];
    for (var f = 0; f < this.mColCnt; ++f) {
        if (this.mColDatas[f].mVisible || (this.mGroup && this.mGroupOrder[0] == this.mColDatas[f].mDataCol)) {
            var s = "";
            var h = this.mColFields[f];
            if (h.hasImgRef()) {
                var q = h.getImgFid();
                var b = u.irv[q];
                if (b == "") {
                    b = -1
                }
                var o = h.getImgURL(b);
                if (o != null) {
                    var g = null;
                    g = h.getImgAltT(b);
                    s = this.imgHtml(o, g, null)
                }
            }
            p[f] = s
        }
    }
    return p
};
DTable.prototype.hasCellColor = function() {
    for (var b = 0; b < this.mColFields.length; b++) {
        if (this.mColFields[b].hasCellColor()) {
            return true
        }
    }
    return false
};
DTable.prototype.getCellColor = function(q) {
    var g = [];
    for (var f = 0; f < this.mColCnt; ++f) {
        if (this.mColDatas[f].mVisible || (this.mGroup && this.mGroupOrder[0] == this.mColDatas[f].mDataCol)) {
            var p = 'style=";';
            var d = this.mColFields[f];
            if (d.hasCellColor()) {
                if (! (q.mXXXDirty && q.mXXXDirty == 2)) {
                    var o = d.getCColorFid();
                    var b = q.ccV[o];
                    if (b == "") {
                        b = -1
                    }
                    var h = d.getCColor(b);
                    p = 'style="background-color:' + h + ";"
                }
            }
            g[f] = p
        }
    }
    return g
};
DTable.prototype.initResults = function() {
    DTable.superclass.initResults.call(this);
    this.mNotRefreshed = false
};
DTable.prototype.findHtmlObject = function(o, g) {
    var b = this.FishOutTR(o);
    if (b == null) {
        return null
    }
    var d = b.firstChild;
    if (d == null) {
        return null
    }
    var h = g;
    for (var f = 0; f < g; ++f) {
        if (!this.mColDatas[f].mVisible) {--h
        }
    }
    while (d) {
        if (d.nodeType == 1) {
            if (h <= 0) {
                break
            }--h
        }
        d = d.nextSibling
    }
    return d
};
DTable.prototype.setFieldVisibilityOnCurrentRow = function(f, q) {
    if (!this.mResult) {
        return
    }
    var k = this.mCurrentRow;
    var p = this.mResult.r.length;
    if (k > p) {
        return
    }
    var b = this.mResult.f.length;
    var o = 0;
    var d = q.split(/,/);
    for (var h = 0; h < d.length; h++) {
        o = this.getColNum(d[h]);
        if ((o > b) || (o < 0)) {
            continue
        }
        this.mResult.r[k].d[o].h = f;
        var g = this.findHtmlObject(k, o);
        if (g) {
            if (f == "1") {
                g.firstChild.style.visibility = "hidden"
            } else {
                g.firstChild.style.visibility = "inherit"
            }
        }
    }
};
DTable.prototype.isTableGroup = function() {
    return this.mGroup
};
DTable.prototype.hasAggregateFunction = function() {
    return this.mFunc
};
DTable.prototype.getFolderCount = function() {
    var b = this.getAllFolderName();
    return b.length
};
DTable.prototype.getAllFolderName = function() {
    var f = new Array();
    if (this.mRowsPresent == 0 || this.mDataTableObj == null || !this.mGroup) {
        return f
    }
    if (this.mDataTableObj.lastChild == null) {
        return f
    }
    var d = this.mDataTableObj.lastChild;
    for (var b = 0; b < d.childNodes.length; b++) {
        var g = d.childNodes[b];
        if (g && (g.className.indexOf("parent") >= 0 || g.className.indexOf("emptyGroup") >= 0)) {
            f.push(g.getAttribute("id"))
        }
    }
    return f
};
DTable.prototype.isFolderExpanded = function(k) {
    var f = false;
    if (this.mRowsPresent == 0 || this.mDataTableObj == null || !this.mGroup) {
        return f
    }
    if (this.mDataTableObj.lastChild == null) {
        return f
    }
    var d = this.mDataTableObj.lastChild;
    for (var b = 0; b < d.childNodes.length; b++) {
        var h = d.childNodes[b];
        if (h && (h.className.indexOf("parent") >= 0 || h.className.indexOf("emptyGroup") >= 0)) {
            var g = h.getAttribute("id");
            if (g == k) {
                f = h.className.indexOf("expanded") >= 0;
                return f
            }
        }
    }
    return f
};
DTable.prototype.getAllFolderStatus = function() {
    var f = new Array();
    if (this.mRowsPresent == 0 || this.mDataTableObj == null || !this.mGroup) {
        return f
    }
    if (this.mDataTableObj.lastChild == null) {
        return f
    }
    var d = this.mDataTableObj.lastChild;
    for (var b = 0; b < d.childNodes.length; b++) {
        var g = d.childNodes[b];
        if (g && (g.className.indexOf("parent") >= 0 || g.className.indexOf("emptyGroup") >= 0)) {
            f.push(g.getAttribute("id"));
            f.push(g.className.indexOf("expanded") >= 0 ? 1 : 0)
        }
    }
    return f
};
DTable.prototype.restoreAllFolderStatus = function(b) {
    for (var f = 0; f < b.length; f += 2) {
        try {
            if (b[f + 1] == 1) {
                $("#T" + this.mID + " #" + b[f]).expand()
            } else {
                $("#T" + this.mID + " #" + b[f]).collapse()
            }
        } catch(d) {}
    }
};
DTable.prototype.expandFolder = function(g) {
    var d = false;
    if (this.mRowsPresent == 0 || this.mDataTableObj == null || !this.mGroup) {
        return d
    }
    if (this.mDataTableObj.lastChild == null) {
        return d
    }
    var b = this.mDataTableObj.lastChild;
    try {
        $("#T" + this.mID + " #" + g).expand();
        d = ture
    } catch(f) {}
    return d
};
DTable.prototype.collapseFolder = function(g) {
    var d = false;
    if (this.mRowsPresent == 0 || this.mDataTableObj == null || !this.mGroup) {
        return d
    }
    if (this.mDataTableObj.lastChild == null) {
        return d
    }
    var b = this.mDataTableObj.lastChild;
    try {
        $("#T" + this.mID + " #" + g).collapse();
        d = ture
    } catch(f) {}
    return d
};
DTable.prototype.getRowCountForFolder = function(q) {
    var o = 0;
    if (this.mRowsPresent == 0 || this.mDataTableObj == null || !this.mGroup) {
        return o
    }
    if (this.mDataTableObj.lastChild == null) {
        return o
    }
    var g = this.mDataTableObj.lastChild;
    for (var f = 0; f < g.childNodes.length; f++) {
        var p = g.childNodes[f];
        if (p && (p.className.indexOf("parent") >= 0 || p.className.indexOf("emptyGroup") >= 0)) {
            var h = p.getAttribute("id");
            if (h == q) {
                for (var d = f + 1; d < g.childNodes.length; d++) {
                    var b = g.childNodes[d];
                    if (b && (b.className.indexOf("parent") >= 0 || b.className.indexOf("emptyGroup") >= 0)) {
                        return o
                    } else {
                        if (b && b.className.indexOf("child-of-" + h) >= 0) {
                            o++
                        }
                    }
                }
                return o
            }
        }
    }
    return o
};
DTable.prototype.ExpandAll = function() {
    if (this.mRowsPresent == 0 || this.mDataTableObj == null || !this.mGroup) {
        return false
    }
    if (this.mDataTableObj.lastChild == null) {
        return false
    }
    var d = this.mDataTableObj.lastChild;
    for (var b = 0; b < d.childNodes.length; b++) {
        var g = d.childNodes[b];
        if (g && (g.className.indexOf("parent") >= 0 || g.className.indexOf("emptyGroup") >= 0)) {
            var f = g.getAttribute("id");
            if (f) {
                $("#T" + this.mID + " #" + f).expand()
            }
        }
    }
    return true
};
DTable.prototype.CollapseAll = function() {
    if (this.mRowsPresent == 0 || this.mDataTableObj == null || !this.mGroup) {
        return false
    }
    if (this.mDataTableObj.lastChild == null) {
        return false
    }
    var d = this.mDataTableObj.lastChild;
    for (var b = 0; b < d.childNodes.length; b++) {
        var g = d.childNodes[b];
        if (g && (g.className.indexOf("parent") >= 0 || g.className.indexOf("emptyGroup") >= 0)) {
            var f = g.getAttribute("id");
            if (f) {
                $("#T" + this.mID + " #" + f).collapse()
            }
        }
    }
    return true
};
DTable.prototype.getChildField = function(d) {
    var g = d.element;
    var b = this.MapUIXY(g);
    if (b == null) {
        return null
    }
    if (b.x < 0) {
        return null
    }
    var f = b.x;
    return this.getFieldIDForColumn(f)
};
DTable.prototype.inDataArea = function(b) {
    var d = b.element;
    while (d.nodeType != 1 || (d.tagName != "DIV")) {
        d = d.parentNode
    }
    if (d != null) {
        if (d.className.indexOf("TableFtr") != -1 || d.className.indexOf("TableHdr") != -1) {
            return false
        }
    }
    return true
};
DTable.prototype.InstantiateUI_Part1 = function(b) {
    this.mSortImgs = [];
    this.mSortImgs[0] = b.firstChild;
    this.mSortImgs[1] = this.mSortImgs[0].nextSibling;
    this.mSortImgs[0].setAttribute("arindom", 1);
    this.mSortImgs[1].setAttribute("arindom", 1);
    this.mHdrObj = this.mSortImgs[1].nextSibling
};
DTable.prototype.InstantiateUI_Part2 = function(h) {
    function b(k, o, p) {
        var q = h.getAttribute("ar" + k + "str");
        if (q == null || q == "") {
            return null
        } else {
            return new TableBtn(q, o, k, p)
        }
    }
    this.mInnerObj = this.mHdrObj.nextSibling;
    this.mFtrObj = this.mInnerObj.nextSibling;
    var g = this.mHdrObj.firstChild.firstChild.firstChild;
    var f = h.getAttribute("archunkbuttons") != null;
    this.mHdrLObj = g.firstChild;
    var d = h.getAttribute("arnotrefstr");
    if (d != null && d.length > 0) {
        this.mHdrLObj.innerHTML = d.HTMLEncode()
    }
    if (f) {
        this.mChunkOuter = g.childNodes[1].firstChild;
        this.mHdrRObj = g.childNodes[2]
    } else {
        this.mChunkOuter = null;
        this.mHdrRObj = g.childNodes[1]
    }
    g = this.mFtrObj.firstChild.firstChild.firstChild;
    this.mFtrLObj = g.firstChild;
    this.mFtrRObj = g.childNodes[1];
    this.mFlushingQueue = 0;
    DTable.superclass.InstantiateUI.call(this, this.mInnerObj);
    if (this.mChunkOuter != null) {
        this.mChunkPrevBtn = this.mChunkOuter.firstChild;
        this.mChunkInput = this.mChunkOuter.childNodes[2];
        this.mChunkMenuBtn = this.mChunkOuter.childNodes[3];
        this.mChunkNextBtn = this.mChunkOuter.childNodes[4];
        if (this.mChunkSize > 0 && this.mResult != undefined) {
            this.UpdateChunkUI(this.mResult)
        }
    } else {
        this.mChunkPrevBtn = this.mChunkInput = this.mChunkMenuBtn = this.mChunkNextBtn = null
    }
    this.mBtnReport = b("Rep", this.mFtrLObj, null);
    if (this.colCheck == 0) {
        if (this.mSelRow != 1) {
            if (this.mSelRow == 0) {
                this.mBtnSelectAll = b("SelAll", this.mFtrLObj, null)
            } else {
                this.mBtnSelectAll = null
            }
            this.mBtnDeselectAll = b("DeselAll", this.mFtrLObj, null)
        }
    } else {
        this.mBtnSelectAll = this.mBtnDeselectAll = null
    }
    this.mBtnDelete = b("Delete", this.mFtrLObj, null);
    this.mBtnRead = b("Read", this.mFtrLObj, null);
    this.mBtnUnread = b("Unread", this.mFtrLObj, null);
    this.mBtnPref = b("Prefs", this.mHdrRObj, RelContextPath + "resources/images/menu_down.gif");
    this.mBtnRefresh = b("Ref", this.mHdrRObj, null);
    this.mUIInstantiated = true;
    if (!this.mAsyncResizePending) {
        this.Resize(parseInt(h.style.width), parseInt(h.style.height))
    }
    this.mAsyncDirty = (3 > this.mAsyncDirty ? 3 : this.mAsyncDirty)
};
DTable.prototype.DOMClickAction = function(f) {
    if (this.colCheck == 1 && this.mSelRow != 1) {
        if (f.parentNode.className == "BaseTableHeader" && f.nodeName == "INPUT" && this.mRowsPresent > 0) {
            if (f.checked) {
                return 1
            }
            return 2
        }
    }
    var b = this.FindContainingDiv(f);
    if (b == null) {
        return 0
    }
    if (b.className == "TableHdr" || b.className == "TableFtr") {
        if (f.tagName == "IMG") {
            f = f.parentNode
        }
        if (f.tagName != "A") {
            return 0
        }
        if (this.mBtnRefresh && f == this.mBtnRefresh.mObj) {
            return 3
        } else {
            if (this.mBtnSelectAll && f == this.mBtnSelectAll.mObj) {
                return 1
            } else {
                if (this.mBtnDeselectAll && f == this.mBtnDeselectAll.mObj) {
                    return 2
                } else {
                    if (this.mBtnDelete && f == this.mBtnDelete.mObj) {
                        return 4
                    } else {
                        if (this.mBtnRead && f == this.mBtnRead.mObj) {
                            return 5
                        } else {
                            if (this.mBtnUnread && f == this.mBtnUnread.mObj) {
                                return 6
                            } else {
                                if (this.mBtnReport && f == this.mBtnReport.mObj) {
                                    return 7
                                } else {
                                    if (this.mBtnPref && f == this.mBtnPref.mObj) {
                                        return 8
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        if (b == this.mChunkOuter) {
            var d = f;
            if (d.tagName == "IMG") {
                d = d.parentNode
            }
            if (d == this.mChunkPrevBtn) {
                return 9
            } else {
                if (d == this.mChunkNextBtn) {
                    return 10
                } else {
                    if (d == this.mChunkMenuBtn) {
                        return 11
                    }
                }
            }
        }
    }
    if ((f.tagName == "A" && f.className.indexOf("TableBtn") != -1) || f.tagName == "IMG") {
        return 12
    } else {
        if (f.tagName == "INPUT" && f.type == "checkbox") {
            return 13
        }
    }
    return 0
};
DTable.prototype.DOMClick = function(b) {
    var d = this.DOMClick_part1(b);
    if (typeof d == "number") {
        return this.DOMClick_part2(b, d)
    } else {
        return d
    }
};
DTable.prototype.DOMClick_part1 = function(s) {
    hoverState.clearTracking();
    if (this.GAccess() == 3) {
        return
    }
    var k = this.DOMClickAction(s.element);
    switch (k) {
    case 1:
        return {
            n:
            {
                f:
                this.SelectAll,
                t: this,
                a: [true]
            }
        };
    case 2:
        return {
            n:
            {
                f:
                this.SelectAll,
                t: this,
                a: [false]
            }
        };
    case 3:
        return {
            n:
            {
                t:
                this,
                f: this.Refresh,
                a: [ - 1, 0, false]
            }
        };
    case 4:
        return this.DeleteSelected();
    case 5:
        return this.MarkRead(true);
    case 6:
        return this.MarkRead(false);
    case 7:
        return this.Report();
    case 8:
        var u = this.FindContainingDiv(s.element);
        if (u == null) {
            return
        }
        u = s.element;
        return {
            n: {
                f: this.Preferences,
                a: [u, this],
                t: this
            }
        };
    case 9:
        return {
            n:
            {
                t:
                this,
                f: this.NextChunk,
                a: [ - 1]
            }
        };
    case 10:
        return {
            n:
            {
                t:
                this,
                f: this.NextChunk,
                a: [1]
            }
        };
    case 11:
        if (!this.mResult) {
            return
        }
        var g = [];
        var f = Math.ceil(this.mResult.n / this.mChunkSize);
        if (f <= 25) {
            for (var p = 0; p < f; ++p) {
                g.push({
                    l: "" + (p + 1),
                    v: "" + p
                })
            }
        } else {
            var q = Math.ceil(f / 25);
            for (var p = 0; p < q; ++p) {
                var d = p * 25,
                h = d + 25;
                if (h > f) {
                    h = f
                }
                var b = [];
                for (var o = d; o < h; ++o) {
                    b.push({
                        l: "" + (o + 1),
                        v: "" + o
                    })
                }
                if (b.length) {
                    g.push({
                        l: (d + 1) + ".." + h,
                        v: b
                    })
                }
            }
        }
        var v = this;
        return {
            n: {
                f: function() {
                    return new DTableMenu(v.windowID, g, v)
                },
                a: [g, v]
            }
        };
        break
    }
    return k
};
DTable.prototype.DOMClick_part2 = function(o, g) {
    switch (g) {
    case 12:
        var q = this.MapUIXY(o.element);
        if (q != null) {
            var d = [],
            f = this.MapUIXToData(q.x);
            if (f == null) {
                return
            }
            if (this.mResult.f[f].t == "Char") {
                if (this.mResult.f[f].m != null) {
                    var k = this.mResult.f[f].m;
                    var d = getARMenuCache_NS(this.windowID)[k];
                    if (d) {
                        d.cfid = this.mColFields[f].mID;
                        if (!d.FieldMap[this.mColFields[f].mID]) {
                            d.addField(this.mColFields[f].mID)
                        }
                    }
                    charmenu = ARMenu_Get(this.windowID, k);
                    if (charmenu) {
                        if (charmenu.mMenuDef.length > 0) {
                            var p = this;
                            return {
                                n: {
                                    f: function() {
                                        return new DEditMenu(p.windowID, charmenu.mMenuDef, o.element, q, f, p)
                                    },
                                    a: [charmenu.mMenuDef, o.element, q, f, p]
                                }
                            }
                        }
                    }
                }
            } else {
                var b = this.mResult.f[f].e;
                for (var h in b) {
                    d.push({
                        l: b[h],
                        v: h
                    })
                }
                d.push({
                    l: getLocalizedMessage("(clear)"),
                    v: ""
                });
                var p = this;
                return {
                    n: {
                        f: function() {
                            return new DEditMenu(p.windowID, d, o.element.parentNode.parentNode.parentNode, q, f, p)
                        }
                    },
                    a: [d, o.element.parentNode.parentNode.parentNode, q, f, p]
                }
            }
        }
        break;
    case 13:
        this.DirtyEditableCell(o.element);
        break
    }
    return DTable.superclass.DOMClick.call(this, o)
};
DTable.prototype.DOMKeyPress = function(b) {
    if (this.GAccess() == 3) {
        return
    }
    var f = b.element;
    if (f == this.mChunkInput && b.key == 13) {
        var d = parseInt(this.mChunkInput.value);
        if (isNaN(d) || d < 1) {
            d = 1
        }--d;
        if (d != this.mChunkPage) {
            this.mChunkPage = d;
            return {
                n: {
                    t: this,
                    f: this.Refresh,
                    a: [ - 1, 0, true]
                }
            }
        }
        return
    }
    this.DirtyEditableCell(f)
};
DTable.prototype.DOMKeyUp = function(b) {
    this.DirtyEditableCell(b.element)
};
DTable.prototype.DOMContextMenu = function(b) {
    Menu_Close();
    if (this.GAccess() != 3) {
        var g = new TableContextMenu(this);
        var d = (b.ox >= b.element.scrollLeft) ? b.ox - b.element.scrollLeft: b.ox;
        var h = {
            x: d,
            y: b.oy
        };
        var f = this.GetContextMenuOffsetElement(b.element);
        return {
            n: {
                f: g.Open,
                t: g,
                a: [f, 4, h]
            }
        }
    }
};
DTable.prototype.GetContextMenuOffsetElement = function(b) {
    return b
};
DTable.prototype.DirtyEditableCell = function(g) {
    if (g.tagName == "INPUT") {
        var f = this.MapUIXY(g);
        if (f != null) {
            var d = this.GetRow();
            this.SetRow(f.y);
            var b = this.mAsyncDirty;
            var h = this.MapUIXToData(f.x);
            if (h != null) {
                if (g.type == "checkbox") {
                    this.mColFields[h].S(g.checked ? new EnumType(g.value) : Null)
                } else {
                    this.mColFields[h].S(new CharType(g.value), true)
                }
            }
            this.mAsyncDirty = b;
            this.SetRow(d)
        }
    }
};
DTable.prototype.DOMKeyDown = function(b) {
    if (this.GAccess() == 3) {
        return
    }
    if (b.key == 8 || b.key == 46) {
        var d = b.element;
        this.DirtyEditableCell(d)
    }
    var d = this.FindContainingDiv(b.element);
    if (d == null) {
        return
    }
    if (d.className == "TableHdr" || d.className == "TableFtr" || d.className == "TableHdrChunk") {
        return
    }
    if (b.key == 37 && b.shift) {
        return {
            n: {
                f: this.NextChunk,
                t: this,
                a: [ - 1]
            }
        }
    } else {
        if (b.key == 39 && b.shift) {
            return {
                n: {
                    f: this.NextChunk,
                    t: this,
                    a: [1]
                }
            }
        } else {
            if (b.key == 116) {
                return {
                    n: {
                        f: this.Refresh,
                        t: this,
                        a: [ - 1, 0, false]
                    }
                }
            } else {
                return DTable.superclass.DOMKeyDown.call(this, b)
            }
        }
    }
    b.StopDefault()
};
DTable.prototype.IsMouseSelectable = function(b) {
    return (this.MouseSelectable || b.isTextEdit)
};
DTable.prototype.UpdateVis = function(d) {
    var b = (this.mObj.style.visibility != "hidden");
    if (!b && d) {
        this.SetAsync( - 1);
        this.mObj.style.visibility = "inherit";
        if (this.mContainerID && (F(this.mContainerID) instanceof DPage) && F(this.mContainerID).mFillModel) {
            this.mObj.style.display = "block"
        }
    } else {
        if (b && !d) {
            this.SetAsync(1);
            this.mObj.style.visibility = "hidden";
            if (this.mContainerID && (F(this.mContainerID) instanceof DPage) && F(this.mContainerID).mFillModel) {
                this.mObj.style.display = "none"
            }
        }
    }
};
DTable.prototype.DOMFocus = function(b) {
    return DTable.superclass.DOMFocus.call(this, b)
};
DTable.prototype.getRowInScroll = function(o) {
    if (o.element.className == "BaseTableInner") {
        var g = o.element;
        var k = g.childNodes;
        var g = null;
        for (var h = 0; h < k.length; h++) {
            if (k[h].className == "BaseTable") {
                g = k[h];
                break
            }
        }
        if (g != null) {
            var s = g.rows;
            var f = s.length;
            var q = g.offsetTop;
            var d;
            posy = o.oy;
            for (var b = 0; b < f; b++) {
                d = q + s[b].clientHeight - 1;
                var p = s[b].getAttribute("arrow");
                if (p != null) {
                    p = parseInt(p)
                }
                if (p != null && posy >= q && posy <= d) {
                    return p
                }
                q = d
            }
        }
    }
    return null
};
DTreeView.prototype = new DTable();
DTreeView.prototype.constructor = DTreeView;
DTreeView.superclass = DTable.prototype;
DOMFieldFactories.TreeView = function(b, f, d) {
    return new DTreeView(b, f, d)
};
DTreeView.NULL_VALUE = getLocalizedMessage("[No Value]");
function DTreeView(d, h, g) {
    if (arguments.length) {
        this.init(d, h, g)
    }
    this.mTreeNode = null;
    this.mExpandSelectedNode = false;
    this.expandOrCollapse = null;
    this.mNullValue = this.mObj.getAttribute("arnullvalue");
    if (this.mNullValue == null || this.mNullValue.length == 0) {
        this.mNullValue = DTreeView.NULL_VALUE
    }
    this.mCols = [];
    var b = this.GetInitialRowSortOrder();
    if (b != null) {
        this.RebuildSortOrder(b.col, b.dir)
    }
    for (var f = 0; f < this.mSortOrder.length; f += 2) {
        this.mCols.push(this.mSortOrder[f])
    }
    if (this.mCols.length <= 0) {
        this.mCols = [0]
    }
    this.mRow = -1;
    this.mLevel = this.mCols.length - 1;
    this.mIndex = "TN" + TreeNode.NextIndex++;
    this.mHasChildFields = false
}
DTreeView.prototype.TabableElementSelector = function(d) {
    if (d.tagName == "DIV" && d.style && d.style.display != "none" && d.style.visiblity != "hidden") {
        var b = d.parentNode;
        if (b != null) {
            if (b.tagName == "DIV" && (!b.style || b.style.display == "none" || b.style.visibility == "hidden")) {
                return null
            }
        }
        return d
    }
    return null
};
DTreeView.prototype.ResizeTo = function(d, b) {
    if (this.mObj.style.width != this.perWidth + "%") {
        this.mObj.style.width = this.perWidth + "%"
    }
    if (this.mObj.style.height != this.perHeight + "%") {
        this.mObj.style.height = this.perHeight + "%"
    }
};
DTreeView.prototype.InstantiateUI = function(b) {
    this.mObj.innerHTML = "<html></html>";
    this.mUIInstantiated = true
};
DTreeView.prototype.BuildTree = function() {
    var O = needPNGFixup();
    var N, L, J, E, Q, R, h;
    var K = new Array();
    var D = new Array();
    var B = -1;
    K[0] = this.mTreeNode = new TreeNode(gTreeMessages, gTreeMsgArgs, this.mIndex, "RootNode", false, B, "", "", null, 0, 0);
    TreeNode.registerRootNode(this.mTreeNode);
    var p = this.GLabel();
    if (p != null && p != "") {
        E = this.mIndex + "_" + 0 + "_" + -1;
        var g = this.getRootImgRef("timg" + E, O);
        var C = null;
        var o = this.getRootImgH();
        var b = this.getRootImgW();
        C = this.getRootImgAltT();
        B = 0;
        h = new TreeNode(gTreeMessages, gTreeMsgArgs, E, p, B, false, "", g, C, o, b);
        K[0].addChild(h);
        K[0] = h
    }
    Q = this.GetData();
    var q = false;
    if (this.GLabel() != null && this.GLabel() != "") {
        q = true
    }
    if (Q.length > 0) {
        var y = this.mCols;
        var G = y.length;
        var H, f;
        var P = this.GetRowColours();
        for (N = 0; N < Q.length; N++) {
            if (!Q[N].mXXXDirty || Q[N].mXXXDirty != 3) {
                f = Q[N];
                for (L = 0; L < G; L++) {
                    R = f.d[y[L]].v;
                    var u = 0;
                    if (R == null || R.length == 0) {
                        R = this.mNullValue;
                        u = 1;
                        if (typeof Q[N].mXXXDirty != "undefined" && Q[N].mXXXDirty == 2) {
                            u = 2
                        }
                    }
                    if (R != D[L]) {
                        H = [];
                        H.push(this.mIndex);
                        H.push("_");
                        H.push(N);
                        H.push("_");
                        H.push(L);
                        E = H.join("");
                        var I = this.getImgRefCell(f, y[L], "timg" + E, O);
                        var w = this.getImgRefHCell(f, y[L]);
                        var d = this.getImgRefWCell(f, y[L]);
                        var s = null;
                        var B = L + 1;
                        if (!q) {
                            B = L
                        }
                        h = new TreeNode(gTreeMessages, gTreeMsgArgs, E, R, B, false, (f.rc == -1 || P == null ? "": P[f.rc]), I, s, w, d);
                        h.setNullNodeType(u);
                        h.startRow = N;
                        h.endRow = N;
                        h.column = L;
                        if (this.mColFields[y[L]].mCFCache.v) {
                            var A = L - 1;
                            while (A >= 0 && !this.mColFields[y[A]].mCFCache.v) {
                                A--
                            }
                            K[A + 1].addChild(h)
                        }
                        K[L + 1] = h;
                        D[L] = R;
                        D.length = L + 1
                    } else {
                        if (h.column == L) {
                            h.endRow = N
                        }
                    }
                    K[L].endRow = N
                }
            }
        }
        this.RemoveNulls(this.mTreeNode)
    }
};
DTreeView.prototype.RemoveNulls = function(h) {
    if (h.hasChilds()) {
        var f = h.getChildren();
        var b = true;
        for (var d = 0; d < f.length; d++) {
            this.RemoveNulls(f[d]);
            if (f[d].getName() != this.mNullValue || f[d].hasChilds()) {
                b = false
            }
            if (f[d].getName() == this.mNullValue && d != 0 && f[d].getNullNodeType() != 2) {
                f[d].makeThisFirstChild();
                var g = f[d].getParent();
                var k = g.endRow;
                g.endRow = g.startRow;
                g.startRow = k
            }
        }
        if (b) {
            h.resetChilds()
        }
    }
};
DTreeView.prototype.ApplyData = function() {
    if (this.mNotRefreshed) {
        this.mTreeNode = null;
        this.mObj.innerHTML = "<html></html>";
        return
    }
    this.mRowsPresent = this.GetData().length;
    TreeNode.showTree(this.mTreeNode, this.mObj, RelContextPath + "resources/");
    var b = this.GLabel();
    if (b != null && b != "" && this.GetData().length > 0) {
        TreeNode.expandNode(this.mTreeNode.getFirstChild(), false)
    }
    this.ApplySelections()
};
DTreeView.prototype.ApplySelections = function() {
    if (!this.mTreeNode.isLoaded() || this.GetData().length <= 0) {
        return
    }
    if (this.mPrimaryRowSelection != null) {
        var d = 0;
        for (var b in this.mRowSelections) {
            d++
        }
        if (this.mRowsPresent > 1 && d == this.mRowsPresent && this.mLevel == -1) {
            this.doSelectNode(0, -1)
        } else {
            this.doSelectNode(this.mRow, this.mLevel)
        }
        var f = this.mIndex + "_" + this.mRow + "_" + this.mLevel;
        TreeNode.selectNodeByID(f);
        if (this.mExpandSelectedNode) {
            TreeNode.expandNode(TreeNode.findNodeWithID(this.mTreeNode, f), false);
            this.mExpandSelectedNode = false
        }
    } else {
        this.mRow = -1;
        this.mTreeNode.ClearSelection()
    }
    if (this.expandOrCollapse) {
        this.expandOrCollapse.apply(this);
        this.expandOrCollapse = null
    }
};
DTreeView.prototype.GetRootNode = function() {
    return this.mTreeNode
};
DTreeView.prototype.SColVis = function(b, d) {};
DTreeView.prototype.SColLabel = function(b, d) {};
DTreeView.prototype.DOMClick = function(b) {
    var d = b.element.id;
    if (d.indexOf("link") == 0 || d.indexOf("title") == 0) {
        return this.DOMClickMouseDownHelper(b)
    }
    return
};
DTreeView.prototype.DOMMouseDown = function(b) {
    return this.DOMClickMouseDownHelper(b)
};
DTreeView.prototype.DOMClickMouseDownHelper = function(b) {
    if (!this.mTreeNode || this.GAccess() == 3) {
        return
    }
    var f = TreeNode.getSelectedNode(this.mTreeNode);
    TreeNode.ClearFocusTimer(this.mTreeNode);
    if (TreeNode.handleSingleClick(b.element)) {
        b.StopDefault()
    }
    var g = F(this.windowID, this.mParentField);
    while (g) {
        if (g instanceof DPage && g.mFillModel && g.mState == 1 && g.mFit) {
            g.getChildScroll(this)
        }
        g = g.GetParent()
    }
    if (this.GetData().length > 0) {
        var h = b.element.id;
        if (h.indexOf("title") == 0) {
            h = h.substring(5)
        } else {
            if (h.indexOf("handler") == 0) {
                h = h.substring(7)
            } else {
                if (h.indexOf("link") == 0) {
                    h = h.substring(4)
                } else {
                    if (h.indexOf("timg") == 0) {
                        h = h.substring(4)
                    } else {
                        if (h.indexOf("node") == 0) {
                            h = h.substring(4)
                        } else {
                            if (h == "") {
                                h = TreeNode.getParentNode(b.element).id.substring(4)
                            } else {
                                return
                            }
                        }
                    }
                }
            }
        }
        var d = TreeNode.getTreeNode(h);
        if (f == d) {
            return
        }
        return this.SelectNode((d.startRow <= d.endRow ? d.startRow: d.endRow), d.column, false, true, true)
    }
};
DTreeView.prototype.DOMDoubleClick = function(b) {
    if (!this.mTreeNode || this.mRowsPresent == 0) {
        return
    }
    TreeNode.handleDoubleClick(b.element);
    var f = b.element.id;
    if (f.indexOf("title") == 0 || f.indexOf("timg") == 0) {
        var d = TreeNode.getTreeNode(f.substring((f.indexOf("title") == 0) ? 5 : 4));
        if (!d.hasChilds()) {
            return DTreeView.superclass.ARDrillDown.call(this, {
                y: d.startRow,
                x: d.column
            },
            false)
        }
    }
};
DTreeView.prototype.setRowAndLevel = function(b) {
    if (b.startRow < b.endRow) {
        this.mRow = b.startRow
    } else {
        this.mRow = b.endRow
    }
    this.mLevel = b.column
};
DTreeView.prototype.doSelectNode = function(h, k) {
    var d = this.FindNode(h, k);
    if (d) {
        var b = [];
        var g = d.parent;
        while (g != null && !g.loaded) {
            b.push(g);
            g = g.parent
        }
        while (b.length > 0) {
            var f = b.pop();
            TreeNode.handleNode(f.id)
        }
        this.setRowAndLevel(d)
    }
};
DTreeView.prototype.SelectNode = function(h, o, f, k, d) {
    if (!this.mTreeNode) {
        return
    }
    if (h < 0 || h > this.mResult.r.length) {
        this.mTreeNode.ClearSelection();
        return
    }
    var g = null;
    if (o > this.mCols.length) {
        o = this.mCols.length
    }
    g = this.FindNode(h, o);
    if (g) {
        var b = [];
        b.push({
            t: this,
            f: this.ApplySelections
        });
        this.setRowAndLevel(g);
        if (f) {
            this.mExpandSelectedNode = true
        }
        if (k) {
            if (g.endRow != g.startRow) {
                b.push({
                    f: this.FillSelections,
                    t: this,
                    a: [g.endRow, g.startRow, g.startRow, true]
                })
            }
            b.push({
                f: this.SetPrimarySelection,
                t: this,
                a: [g.startRow, d, true, true]
            })
        }
        return {
            n: b
        }
    }
};
DTreeView.prototype.DOMFocus = function(b) {
    if (this.mTreeNode != null) {
        var d = TreeNode.getSelectedNode(this.mTreeNode);
        if (d != null) {
            TreeNode.makeNodeVisible(d);
            TreeNode.SetFocusToSelectedNode(this.mTreeNode)
        } else {
            if (this.mTreeNode.getFirstChild() != null) {
                this.mTreeNode.getFirstChild().SetFocus()
            }
        }
    }
    return DTable.superclass.DOMFocus.call(this, b)
};
DTreeView.prototype.GetSelectedColumn = function(d) {
    var b;
    if (this.mPrimaryRowSelection == null) {
        b = Null
    } else {
        if (d == 1) {
            if (this.mLevel == -1) {
                return Null
            } else {
                b = new IntegerType(this.mColFields[this.mCols[this.mLevel]].mID)
            }
        } else {
            b = new IntegerType(this.mLevel + 1)
        }
    }
    return b
};
DTreeView.prototype.IsLeafSelected = function() {
    var b = null;
    if (this.mTreeNode != null) {
        var d = TreeNode.getSelectedNode(this.mTreeNode);
        if (d == null) {
            d = this.FindNode(this.mRow, this.mLevel)
        }
        if (d && d.getChildCount() == 0) {
            b = IntegerType.ONE
        }
    }
    if (b == null) {
        b = IntegerType.ZERO
    }
    return b
};
DTreeView.prototype.ExpandAll = function() {
    if (this.mTreeNode && this.mTreeNode.loaded) {
        TreeNode.expandAll(this.mTreeNode)
    } else {
        if (!this.mNotRefreshed) {
            this.expandOrCollapse = this.ExpandAll
        }
    }
    var b = F(this.windowID, this.mParentField);
    while (b) {
        if (b instanceof DPage && b.mFillModel && b.mState == 1 && b.mFit) {
            b.getChildScroll(this)
        }
        b = b.GetParent()
    }
};
DTreeView.prototype.CollapseAll = function() {
    if (this.mTreeNode && this.mTreeNode.loaded) {
        TreeNode.collapseAll(this.mTreeNode)
    } else {
        if (!this.mNotRefreshed) {
            this.expandOrCollapse = this.CollapseAll
        }
    }
};
DTreeView.prototype.UpdateLabel = function(b) {
    if (!this.mTreeNode) {
        return
    }
    node = TreeNode.findNodeWithID(this.mTreeNode, this.mIndex + "_" + 0 + "_" + -1);
    if (b == null || b == "") {
        b = this.mNullValue
    }
    if (node != null) {
        node.changeLabel(b)
    }
};
DTreeView.prototype.getChildField = function(b) {
    return null
};
DTreeView.prototype.DoSet = DTreeView.prototype.DoSLoadEntry = function(g) {
    if (!this.mTreeNode) {
        return DTreeView.superclass.DoSet.call(this, g)
    }
    var b = g;
    if (g instanceof Datatype) {
        g = g.toInteger()
    } else {
        if (g == "") {
            g = 0
        } else {
            g = parseInt(g)
        }
    }
    var d = true;
    if (g < 0) {
        g = -g
    }
    if (g > 100000000 || g < -100000000) {
        d = false
    }
    if (g == 0 || g > this.GetData().length && g < 100000000) {
        this.mTreeNode.ClearSelection()
    } else {
        if (d) {
            this.SelectNode(g - 1, this.mCols.length - 1, false, false, false)
        }
    }
    var f = DTreeView.superclass.DoSet.call(this, b);
    return f
};
DTreeView.prototype.ARRowSelected = function(f, d, b, h) {
    var g = this.FindNode(this.mARRowSelection - 1, this.mLevel);
    if (g) {
        this.setRowAndLevel(g)
    }
    return DTreeView.superclass.ARRowSelected.call(this, f, d, b)
};
DTreeView.prototype.FindNode = function(d, g) {
    var h = d;
    var b = g;
    var k, f = null;
    do {
        if (b == -1) {
            k = this.mIndex + "_" + 0 + "_" + b
        } else {
            k = this.mIndex + "_" + h + "_" + b
        }
        f = TreeNode.findNodeWithID(this.mTreeNode, k);
        if (f == null) {
            h--
        } else {
            if ((d >= f.startRow && d <= f.endRow) || (d <= f.startRow && d >= f.endRow)) {
                break
            }
        }
        if (f != null || h < 0) {
            h = d;
            b--
        }
    } while ( b >= 0 );
    if (f && this.mResult.r[d].mXXXDirty == 2) {
        f.column = g
    }
    return f
};
DTreeView.prototype.NextChunk = function(b) {};
DTreeView.prototype.Report = function() {};
DTreeView.prototype.Refresh = function(d, b, h, g) {
    this.mTreeNode = null;
    this.mObj.innerHTML = "<html></html>";
    if (!this.mNotRefreshed) {
        var f = parseInt(this.mObj.getAttribute("arselrefresh"));
        if (f == 2 || f == 3) {
            this.mLevel = this.mCols.length - 1
        }
    }
    return DTreeView.superclass.Refresh.call(this, -1, 0, false, g)
};
DTreeView.prototype.Clear = function() {
    this.mLevel = this.mCols.length - 1;
    return DTreeView.superclass.Clear.call(this)
};
DTreeView.prototype.SelectAll = function(b) {
    var d = this.GLabel();
    if (d == null || d == "") {
        b = false
    }
    return DTreeView.superclass.SelectAll.call(this, b)
};
DTreeView.prototype.DOMKeyPress = function(b) {};
DTreeView.prototype.DOMKeyUp = function(b) {};
DTreeView.prototype.DOMKeyDown = function(b) {
    if (this.GAccess() == 3 || !this.mTreeNode) {
        return
    }
    var h = TreeNode.getSelectedNodeID(this.mTreeNode);
    var f;
    if (b.element != null && b.element.id != null) {
        f = TreeNode.getTreeNode(b.element.id.replace("title", ""));
        if (f == null) {
            return
        }
    }
    if (b.key == 37) {
        b.StopDefault();
        TreeNode.collapseCurrentNode(this.mTreeNode, f)
    } else {
        if (b.key == 39) {
            b.StopDefault();
            TreeNode.expandCurrentNode(this.windowID, this.mTreeNode, f, this)
        } else {
            if (b.key == 38) {
                b.StopDefault();
                TreeNode.selectPrevNode(this.mTreeNode, f)
            } else {
                if (b.key == 40) {
                    b.StopDefault();
                    TreeNode.selectNextNode(this.mTreeNode, f)
                } else {
                    if (b.key == 32) {
                        b.StopDefault();
                        TreeNode.selectNodeByID(f.getID())
                    } else {
                        if (b.key == 13) {
                            b.StopDefault();
                            TreeNode.selectNodeByID(f.getID());
                            if (!f.hasChilds()) {
                                return DTreeView.superclass.ARDrillDown.call(this, {
                                    y: f.startRow,
                                    x: f.column
                                },
                                false)
                            }
                        } else {
                            return
                        }
                    }
                }
            }
        }
    }
    var d = TreeNode.getSelectedNodeID(this.mTreeNode);
    if (h != d) {
        var g = TreeNode.getSelectedNode(this.mTreeNode);
        TreeNode.SetFocusToSelectedNode(this.mTreeNode);
        return this.SelectNode((g.startRow <= g.endRow ? g.startRow: g.endRow), g.column, false, true, true)
    }
};
DTreeView.prototype.IsMouseSelectable = function(b) {
    return false
};
DTreeView.prototype.setStyle = function(b) {
    if (this.mObj.id.indexOf("title") == 0) {
        if (b) {
            this.mObj.className = this.mObj.className + " TreeHover"
        } else {
            this.mObj.className = this.mObj.className.replace(" TreeHover", "")
        }
    }
};
DTreeView.prototype.DOMMouseOver = function(b) {
    hoverState.eventMouseOver(b);
    if (this.GAccess() == 3) {
        return
    }
    this.setStyle(true);
    var d = TreeNode.getParentNode(b.element);
    if (d.className == "") {
        d.className = "btn treetitlerollover";
        d.firstChild.lastChild.className += " treetitlerollover";
        if (d.firstChild.lastChild.previousSibling.tagName == "A") {
            d.firstChild.lastChild.previousSibling.className += " treetitlerollover"
        }
    } else {
        if (d.className.indexOf("treetitleselectedfocused") != -1) {
            d.className += " treetitleselectedrollover";
            d.firstChild.lastChild.className += " treetitleselectedrollover";
            if (d.firstChild.lastChild.previousSibling.tagName == "A") {
                d.firstChild.lastChild.previousSibling.className += " treetitleselectedrollover"
            }
        }
    }
};
DTreeView.prototype.DOMMouseOut = function(b) {
    hoverState.eventMouseOut(b);
    if (this.GAccess() == 3) {
        return
    }
    this.setStyle(false);
    var d = TreeNode.getParentNode(b.element);
    if (d.className.indexOf("treetitlerollover") != -1) {
        d.className = "";
        d.firstChild.lastChild.className = d.firstChild.lastChild.className.replace(/treetitlerollover/g, "");
        d.firstChild.lastChild.className = d.firstChild.lastChild.className.replace(/\s+$/g, "");
        if (d.firstChild.lastChild.previousSibling.tagName == "A") {
            d.firstChild.lastChild.previousSibling.className = d.firstChild.lastChild.previousSibling.className.replace(/treetitlerollover/g, "");
            d.firstChild.lastChild.previousSibling.className = d.firstChild.lastChild.previousSibling.className.replace(/\s+$/g, "")
        }
    } else {
        if (d.className.indexOf("treetitleselectedrollover") != -1) {
            d.className = d.className.replace(/treetitleselectedrollover/g, "");
            d.className = d.className.replace(/\s+$/g, "");
            d.firstChild.lastChild.className = d.firstChild.lastChild.className.replace(/treetitleselectedrollover/g, "");
            d.firstChild.lastChild.className = d.firstChild.lastChild.className.replace(/\s+$/g, "");
            if (d.firstChild.lastChild.previousSibling.tagName == "A") {
                d.firstChild.lastChild.previousSibling.className = d.firstChild.lastChild.previousSibling.className.replace(/treetitleselectedrollover/g, "");
                d.firstChild.lastChild.previousSibling.className = d.firstChild.lastChild.previousSibling.className.replace(/\s+$/g, "")
            }
        }
    }
};
DTreeView.prototype.DOMMouseUp = function(b) {
    var g = b.element.id;
    var f;
    if (g.indexOf("title") == 0) {
        f = g.substring(5)
    } else {
        if (g.indexOf("handler") == 0) {
            f = g.substring(7)
        } else {
            if (g.indexOf("link") == 0) {
                f = g.substring(4)
            } else {
                if (g.indexOf("timg") == 0) {
                    f = g.substring(4)
                } else {
                    this.mMouseUpRowSelection = -1;
                    this.mMouseUpColSelection = -1;
                    return
                }
            }
        }
    }
    var d = TreeNode.getTreeNode(f);
    if (d == null) {
        this.mMouseUpRowSelection = -1;
        this.mMouseUpColSelection = -1;
        return
    }
    if (d.startRow < d.endRow) {
        this.mMouseUpRowSelection = d.startRow
    } else {
        this.mMouseUpRowSelection = d.endRow
    }
    this.mMouseUpColSelection = d.column
};
DTreeView.prototype.getScrollheight = function() {
    var b = 0;
    var d = this.mObj;
    if (d.scrollHeight > d.offsetHeight) {
        b = d.scrollHeight - d.offsetHeight
    }
    return b
};
DTreeView.prototype.getScrollwidth = function() {
    var b = 0;
    var d = this.mObj;
    if (d.scrollWidth > d.offsetWidth) {
        b = d.scrollWidth - d.offsetWidth
    }
    return b
};
DTreeView.prototype.initResults = function() {
    DTable.superclass.initResults.call(this);
    this.BuildTree();
    this.mNotRefreshed = false
};
DTreeView.prototype.hasRootImg = function() {
    var b = this.mObj.getAttribute("arrtimg");
    if (b != null && b.length > 0) {
        return true
    }
    return false
};
DTreeView.prototype.getRootImgW = function() {
    var b = this.mObj.getAttribute("arrtimgw");
    if (b != null && b.length > 0) {
        return parseInt(b)
    }
    return 0
};
DTreeView.prototype.getRootImgH = function() {
    var b = this.mObj.getAttribute("arrtimgh");
    if (b != null && b.length > 0) {
        return parseInt(b)
    }
    return 0
};
DTreeView.prototype.getRootImgURL = function() {
    var b = this.mObj.getAttribute("arrtimg");
    if (b != null && b.length > 0) {
        return b
    }
    return null
};
DTreeView.prototype.getRootImgAltT = function() {
    var b = this.mObj.getAttribute("arrtalt");
    if (b != null && b.length > 0) {
        return b
    }
    return null
};
DTreeView.prototype.getRootImgFType = function() {
    var b = this.mObj.getAttribute("arrtf");
    if (b != null && b.length > 0) {
        return b
    }
    return null
};
DTreeView.prototype.imgHtml = function(d, b, g) {
    var f = '<img class="treeimgicon" src=' + d.HTMLEncode() + " alt=";
    if (b == null) {
        f += '""'
    } else {
        f += '"' + b.HTMLEncode() + '"'
    }
    f += " title=";
    if (b == null) {
        f += '""'
    } else {
        f += '"' + b.HTMLEncode() + '"'
    }
    if (g != null && g.length > 0) {
        f += ' id="' + g + '"'
    }
    f += ' height="{0}px" width="{1}px"';
    f += ">&nbsp;";
    return f
};
DTreeView.prototype.getRootImgRef = function(d, f) {
    if (!this.hasRootImg()) {
        return ""
    }
    var h = "";
    var b = this.getRootImgURL();
    if (b != null && b.length > 0) {
        var g = null;
        g = this.getRootImgAltT();
        h = this.imgHtml(b, g, d)
    }
    return h
};
DTreeView.prototype.getImgRefAltCell = function(d, b) {
    return null
};
DTreeView.prototype.getImgRefCell = function(s, p, g, d) {
    if (!this.hasVisImgRefs()) {
        return ""
    }
    var q = "";
    if (this.mColDatas[p].mVisible) {
        var h = this.mColFields[p];
        if (h.hasImgRef()) {
            var o = h.getImgFid();
            var b = s.irv[o];
            if (b == "") {
                b = -1
            }
            var k = h.getImgURL(b);
            if (k != null) {
                var f = null;
                f = h.getImgAltT(b);
                q = this.imgHtml(k, f, g)
            }
        }
    }
    return q
};
DTreeView.prototype.getImgRefHCell = function(h, f) {
    if (!this.hasVisImgRefs()) {
        return 0
    }
    var k = 0;
    if (this.mColDatas[f].mVisible) {
        var d = this.mColFields[f];
        if (d.hasImgRef()) {
            var g = d.getImgFid();
            var b = h.irv[g];
            if (b == "") {
                b = -1
            }
            k = d.getImgH(b)
        }
    }
    return k
};
DTreeView.prototype.getImgRefWCell = function(k, f) {
    if (!this.hasVisImgRefs()) {
        return 0
    }
    var h = 0;
    if (this.mColDatas[f].mVisible) {
        var d = this.mColFields[f];
        if (d.hasImgRef()) {
            var g = d.getImgFid();
            var b = k.irv[g];
            if (b == "") {
                b = -1
            }
            h = d.getImgW(b)
        }
    }
    return h
};
DPageArray.prototype = new DTable();
DPageArray.prototype.constructor = DPageArray;
DPageArray.superclass = DTable.prototype;
DOMFieldFactories.PageArray = function(b, f, d) {
    return new DPageArray(b, f, d)
};
function DPageArray(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DPageArray.prototype.init = function(d, o, k) {
    this.mPaneltemplate = k.getAttribute("arptemplate");
    this.mPanelBorderColor = k.getAttribute("arpanelbordercolor");
    this.mPanelBorderWidth = k.getAttribute("arpanelborderwidth");
    this.mPanelHorSpace = k.getAttribute("arpanelhorspace");
    this.mPanelVerSpace = k.getAttribute("arpanelverspace");
    this.mPanelLeftMargin = k.getAttribute("arpanellmargin");
    this.mPanelRightMargin = k.getAttribute("arpanelrmargin");
    this.mPanelTopMargin = k.getAttribute("arpaneltmargin");
    this.mPanelBottomMargin = k.getAttribute("arpanelbmargin");
    this.mPanelBKGImageDIV = k.getAttribute("arimagediv");
    DPageArray.superclass.init.call(this, d, o, k);
    this.mColours = this.GetRowColours();
    this.mBkgcolours = this.GetBkgRowColours();
    this.mResizeWidth = -1;
    this.mResizeHeight = -1;
    this.mHasChildFields = true;
    var h = this.getHoverEvtList();
    var g = false;
    var b = null;
    for (var f = 0; f < h.length; f++) {
        idx = f;
        b = AREventFunction(d, h[f], this.mID);
        if (b != null) {
            g = true;
            break
        }
    }
    if (!g) {
        g = this.hoverEvtonChildren()
    }
    this.mHasHoverEvt = g
};
DPageArray.prototype.ApplyData = function() {
    if (!this.mFirstLayout && this.mRowsPresent == 0 && this.GetData().length == 0 && !this.mDirtyColumns) {
        return
    }
    var o;
    if (this.mColDatas.length == 0) {
        o = []
    } else {
        o = this.GetData()
    }
    var d = (o.length > 0);
    var q = this.getPageArray(o);
    if (FocusMgr.mCurFocusID == this.mID && FocusMgr.mCurFocusElement != null) {
        this.mResetFocusToRowAfterRefresh = this.mCurrentRow;
        this.mResetFocusToColumnAfterRefresh = this.mCurrentCol
    }
    this.mInner.innerHTML = q.join("");
    this.mRowsPresent = o.length;
    this.mDataTableObj = this.mInner.firstChild;
    if (o.length > 0) {
        this.mInner.style.overflow = "auto"
    }
    if (this.mBtnReport) {
        this.mBtnReport.SetVisibility(d)
    }
    if (this.mBtnSelectAll) {
        this.mBtnSelectAll.SetVisibility(d)
    }
    if (this.mBtnDeselectAll) {
        this.mBtnDeselectAll.SetVisibility(d)
    }
    if (this.mBtnDelete) {
        this.mBtnDelete.SetVisibility(d)
    }
    if (this.mBtnRead) {
        this.mBtnRead.SetVisibility(d)
    }
    if (this.mBtnUnread) {
        this.mBtnUnread.SetVisibility(d)
    }
    if (this.mChunkOuter) {
        this.mChunkOuter.style.visibility = (d ? "inherit": "hidden")
    }
    if (FocusMgr.mCurFocusID == this.mID && FocusMgr.mCurFocusElement != null) {
        var k = this.getFocusElementForReset(this.mResetFocusToRowAfterRefresh, this.mResetFocusToColumnAfterRefresh, FocusMgr.mCurFocusElement);
        var u = this.windowID;
        setTimeout(function() {
            FocusMgr.TryFocus(u, k)
        },
        50)
    }
    this.ApplySizes();
    if (this.mContainerID && d) {
        var b = getFields_NS(this.windowID)[this.mContainerID];
        if (b instanceof DPage && b.mFit) {
            if (b.mParentObj && b.mParentObj.mViewTypeObj && b.mParentObj.mViewTypeObj.mOrientation == "horizontal") {
                this.mResizeWidth = b.mxSize
            } else {
                this.mResizeHeight = b.mxSize
            }
        }
    }
    var s = null;
    var v = false;
    if (!this.mParentField) {
        s = getFormContainerPane_NS(this.windowID)
    } else {
        s = F(this.windowID, this.mParentField)
    }
    if (s != null && s != "undefined") {
        v = s.mObj.getAttribute("arfillstyle") == 1 ? true: false
    }
    if (v == true) {
        var p = parseFloat(this.mPanelWidth) + parseFloat(this.mPanelHorSpace);
        var f = Math.floor((this.mResizeWidth - parseFloat(this.mPanelHorSpace) + parseFloat(this.mPanelRightMargin)) / p);
        if (f == 0) {
            f = 1
        }
        this.mPanelNumber = f
    }
    if (this.mResizeWidth != -1 && this.mResizeHeight != -1) {
        this.ResizeTo(this.mResizeWidth, this.mResizeHeight)
    }
    this.mLastRowSelections = {};
    this.ApplySelections();
    this.mFirstLayout = false;
    if (typeof AnimMgr != "undefined" && typeof this.mHighlight != "undefined" && this.mHighlight.length > 0 && this.mID != 91530) {
        highlight = true;
        for (var h = 0; h < this.mHighlight.length; ++h) {
            var g = this.findHtmlObject(this.mHighlight[h].r, this.mHighlight[h].c);
            if (g != null) {
                AnimMgr.Highlight(this.mColFields[this.mHighlight[h].c], g)
            }
        }
        this.mHighlight = [];
        highlight = false
    }
};
DPageArray.prototype.getPageArray = function(J) {
    var I = J.length;
    var p = [];
    var h = 0;
    var k = 0;
    var q = 0;
    if (I > 0) {
        q = Math.ceil(I / this.mPanelNumber);
        h = q * (parseFloat(this.mPanelHeight) + parseFloat(this.mPanelVerSpace)) - parseFloat(this.mPanelVerSpace) + parseFloat(this.mPanelBottomMargin);
        k = parseFloat(this.mPanelNumber) * (parseFloat(this.mPanelWidth) + parseFloat(this.mPanelHorSpace)) - parseFloat(this.mPanelHorSpace) + parseFloat(this.mPanelRightMargin)
    }
    p.push('<div class="pagetable" style="height:' + h + ";width:" + k);
    p.push(";margin-left:");
    p.push(this.mPanelLeftMargin);
    p.push("px;margin-right:");
    p.push(this.mPanelRightMargin);
    p.push("px;margin-top:");
    p.push(this.mPanelTopMargin);
    p.push("px;margin-bottom:");
    p.push(this.mPanelBottomMargin);
    p.push('px">');
    if (I > 0) {
        var B = new Array(this.mColCnt);
        var w = new Array(this.mColCnt);
        if (I > 0) {
            for (var C = 0; C < this.mColCnt; C++) {
                B[C] = this.mColFields[C].mID
            }
        }
        var d = new RegExp("<iframe(.*)</iframe>", "i");
        var s = this.mColDatas;
        var H = 0;
        for (var D = 0; D < I; ++D) {
            if (!J[D].mXXXDirty || J[D].mXXXDirty != 3) {
                var E = this.mPaneltemplate.replace(/ROW_NUMBER/, D);
                if (this.mPanelNumber > 0) {
                    if (H < this.mPanelNumber) {
                        var o = 0;
                        var K = H * (parseFloat(this.mPanelWidth) + parseFloat(this.mPanelHorSpace))
                    } else {
                        var A = Math.floor(H / this.mPanelNumber);
                        o = A * (parseFloat(this.mPanelHeight) + parseFloat(this.mPanelVerSpace));
                        K = (H % this.mPanelNumber) * (parseFloat(this.mPanelWidth) + parseFloat(this.mPanelHorSpace))
                    }
                    E = E.replace(/LEFT_VALUE/, K).replace(/TOP_VALUE/, o)
                }
                if (this.mBkgcolours != null && J[D].rc < this.mBkgcolours.length) {
                    E = E.replace(/BKG_COLOR/, this.mBkgcolours[J[D].rc])
                }
                p.push(E);
                p.push(this.mPanelBKGImageDIV);
                for (var G = 0; G < this.mColCnt; G++) {
                    if (J[D].d[G].v.indexOf("&lt;") == -1) {
                        w[G] = J[D].d[G].v
                    } else {
                        w[G] = J[D].d[G].p
                    }
                }
                var y = this.mObj.getAttribute("arserver");
                y = ExpandServerName(this.windowID, y);
                var v = this.mObj.getAttribute("arschema");
                v = ExpandSchemaName(this.windowID, v);
                for (var C = 0; C < this.mColCnt; C++) {
                    if (("template" in this.mColFields[C].mObj) && (this.mColFields[C].mObj.template != null)) {
                        var f = this.mColFields[C].mObj.template;
                        var g = J[D].d[C].v;
                        if (this.mColFields[C].GetDataField() && this.mColFields[C].GetDataField().isRTF && this.mColFields[C].GetDataField().isRTF()) {
                            g = updateRtfHtml(this.windowID, J[D].d[C].p, J[D].i, y, v)
                        }
                        if (J[D].d[C].h == "1") {
                            f = f.replace(/STRING_VALUE/, g).replace(/VISIBILITY_VALUE/, "hidden")
                        } else {
                            if (J[D].d[C].h == "0") {
                                f = f.replace(/STRING_VALUE/, g)
                            } else {
                                if (!s[C].mVisible || s[C].mWidth <= 0) {
                                    f = f.replace(/STRING_VALUE/, g).replace(/VISIBILITY_VALUE/, "hidden")
                                } else {
                                    f = f.replace(/STRING_VALUE/, g)
                                }
                            }
                        }
                        if (("et" in this.mColFields[C].mObj) && (this.mColFields[C].mObj.et != 0)) {
                            f = f.replace("CHECKED" + J[D].d[C].p, "CHECKED").replace(/RCGroup/g, "RCGroup" + D).replace(/rccc/g, "rc" + D)
                        }
                        if (this.mColours != null && J[D].rc < this.mColours.length) {
                            f = f.replace(/ROW_COLOR/g, this.mColours[J[D].rc])
                        }
                        if (("mCFCache" in this.mColFields[C])) {
                            f = f.replace(/NEW_LABEL/g, this.mColFields[C].mCFCache.l)
                        }
                        if (this.mResult.f[C].t == "View") {
                            if (("vt" in this.mColFields[C].mObj) || ("vt" in this.mResult.r[D].d[C])) {
                                if (! ("vt" in this.mResult.r[D].d[C])) {
                                    this.mResult.r[D].d[C].vt = this.mColFields[C].mObj.vt
                                }
                                var b = DView.TEMPLATENAMERE.exec(this.mResult.r[D].d[C].vt);
                                var u = null;
                                if (b != null) {
                                    u = T(this.windowID, b[1])
                                }
                                if (u != null) {
                                    u.setDefaultParamValues();
                                    this.mResult.r[D].d[C].gt = u.process(this.windowID, B, w);
                                    f = f.replace(/DCF_SRC/g, "").replace(/DVFol&#40;&#41;/g, "F(" + this.windowID + "," + this.mID + ").ol(" + D + "," + C + ",true)")
                                } else {
                                    var b = DocView.URLPAT.exec(this.mResult.r[D].d[C].vt);
                                    if (b != null) {
                                        f = f.replace(/DCF_SRC/g, this.mResult.r[D].d[C].vt).replace(/DVFol&#40;&#41;/g, "F(" + this.windowID + "," + this.mID + ").ol(" + D + "," + C + ",false)")
                                    } else {
                                        f = f.replace(/DCF_SRC/g, "").replace(d, this.mResult.r[D].d[C].vt)
                                    }
                                }
                            }
                        }
                        p.push(f)
                    }
                }
                p.push("</div></fieldset>");
                H++
            }
        }
    }
    p.push("</div>");
    return p
};
DPageArray.prototype.ol = function(k, f, d) {
    if (d) {
        var b = this.findHtmlObject(k, f);
        var h = new DocView(b);
        var g = false;
        h.S(this.mResult.r[k].d[f].gt, g)
    }
    if (k == this.GetData().length - 1) {
        inner = this.mInner;
        setTimeout(function() {
            inner.scrollTop = 0
        },
        0)
    }
};
DPageArray.prototype.ResizeTo = function(f, y) {
    if (this.mResizeWidth == f && this.mResizeHeight == y) {
        return
    }
    this.mResizeWidth = f;
    this.mResizeHeight = y;
    DPageArray.superclass.ResizeTo.call(this, f, y);
    var s;
    if (this.mColDatas.length == 0) {
        s = []
    } else {
        s = this.GetData()
    }
    var v = s.length;
    var w = this.mDataTableObj;
    if (v > 0 && w && w.children && w.children.length > 0) {
        var u = parseFloat(this.mPanelWidth) + parseFloat(this.mPanelHorSpace);
        var o = Math.floor((f - parseFloat(this.mPanelHorSpace) + parseFloat(this.mPanelRightMargin)) / u);
        if (o == 0) {
            o = 1
        }
        var g = Math.ceil(v / o);
        var k = g * (parseFloat(this.mPanelHeight) + parseFloat(this.mPanelVerSpace)) - parseFloat(this.mPanelVerSpace) + parseFloat(this.mPanelBottomMargin);
        var d = parseFloat(o) * (parseFloat(this.mPanelWidth) + parseFloat(this.mPanelHorSpace)) - parseFloat(this.mPanelHorSpace) + parseFloat(this.mPanelRightMargin);
        w.style.width = d;
        w.style.height = k;
        w = w.firstChild;
        for (var q = 0; q < v; ++q) {
            if (q < o) {
                var p = 0;
                var b = q * (parseFloat(this.mPanelWidth) + parseFloat(this.mPanelHorSpace))
            } else {
                var h = Math.floor(q / o);
                p = h * (parseFloat(this.mPanelHeight) + parseFloat(this.mPanelVerSpace));
                b = (q % o) * (parseFloat(this.mPanelWidth) + parseFloat(this.mPanelHorSpace))
            }
            w.style.left = b;
            w.style.top = p;
            w = w.nextSibling
        }
    }
};
DPageArray.prototype.InstantiateUI_Part1 = function(b) {
    this.mPanelNumber = b.getAttribute("arpanelnumber");
    if (this.mPanelNumber > 0) {
        this.mPanelWidth = b.getAttribute("arpanelwidth");
        this.mPanelHeight = b.getAttribute("arpanelheight")
    }
    this.mHdrObj = b.firstChild
};
DPageArray.prototype.FindContainingSpan = function(b) {
    while (b.nodeType != 1 || (b.tagName != "SPAN")) {
        b = b.parentNode
    }
    return b
};
DPageArray.prototype.DOMClick = function(g) {
    var b = this.DOMClick_part1(g);
    if (typeof b != "undefined" && typeof b != "number") {
        return b
    }
    var o = [];
    h = g.element;
    while ((h != null) && (h.nodeType != 1 || h.getAttribute("id") != "pagerow")) {
        h = h.parentNode
    }
    if (h == null) {
        return
    }
    var p = this.MapUIXY(g.element);
    if (p == null) {
        return
    }
    var q = p.y;
    this.mCurrentCol = p.x;
    var h = g.element;
    if (this.IsLabelPart(h) || h.tagName == "LABEL") {
        g.StopBubbling();
        g.StopDefault();
        var k = this.FindContainingDiv(h);
        if (k && k.className.indexOf("radio") != -1) {
            var f = true
        }
    }
    var d = FakeButton_Find(g.element);
    if (d) {
        if ((d.className.indexOf("spinnerup") != -1) || (d.className.indexOf("spinnerdown") != -1)) {
            return
        }
        if (d.getAttribute("artype") == "Control") {
            var f = true
        }
    }
    if (this.mSelRow != 1) {
        if (!g.ctrl && !g.shift && !g.meta) {
            if ((g.element.tagName == "IMG") || (g.element.tagName == "A") || ((g.element.tagName == "INPUT") && ((g.element.type == "radio") || (g.element.type == "checkbox") || (g.element.type == "text"))) || ((g.element.tagName == "DIV") && (g.element.className && g.element.className.indexOf(" rtf") != -1)) || (typeof f != "undefined")) {
                o.push({
                    t: this.mColFields[p.x],
                    f: this.mColFields[p.x].DOMClick,
                    a: [g]
                })
            }
            if (this.mPrimaryRowSelection == null || q != this.RowNoFromTag(this.mPrimaryRowSelection) || q != this.mLastRowSelection) {
                o.push({
                    t: this,
                    f: this.ApplySelections
                });
                o.push({
                    f: this.SetPrimarySelection,
                    t: this,
                    a: [q, true, true, true]
                })
            }
        } else {
            if (this.mSelRow == 0) {
                if (!g.shift && (g.ctrl || g.meta)) {
                    o.push({
                        t: this,
                        f: this.ApplySelections
                    });
                    o.push({
                        f: function() {
                            this.mLastRowSelection = q
                        },
                        t: this
                    });
                    o.push({
                        f: this.EORSelections,
                        t: this,
                        a: [q, false, false]
                    })
                }
            }
        }
    } else {
        if (!g.ctrl && !g.shift && !g.meta) {
            if ((g.element.tagName == "IMG") || (g.element.tagName == "A") || ((g.element.tagName == "INPUT") && ((g.element.type == "radio") || (g.element.type == "checkbox") || (g.element.type == "text"))) || ((g.element.tagName == "DIV") && (g.element.className && g.element.className.indexOf(" rtf") != -1)) || (typeof f != "undefined")) {
                o.push({
                    t: this.mColFields[p.x],
                    f: this.mColFields[p.x].DOMClick,
                    a: [g]
                })
            }
        }
    }
    return {
        n: o
    }
};
DPageArray.prototype.DOMMouseDown = function(f) {
    var g = this.MapUIXY(f.element);
    if (g) {
        this.mMouseDownRowSelection = g.y
    } else {
        this.mMouseDownRowSelection = -1
    }
    if (this.GAccess() == 3) {
        if (f.element.type == "radio" && f.element.name != null && f.element.name != "undefined") {
            dradiobutt = document.getElementsByName(f.element.name);
            for (i = 0; i < dradiobutt.length; i++) {
                if (dradiobutt[i].checked == true) {
                    f.element.disabledindex = i
                }
            }
        }
        return
    }
    var o = this.FindContainingDiv(f.element);
    if (o == null) {
        return
    }
    if (o.className != "TableHdr" && o.className != "TableFtr" && o != this.mChunkOuter) {
        o = f.element;
        while ((o != null) && (o.nodeType != 1 || o.getAttribute("id") != "pagerow")) {
            o = o.parentNode
        }
        if (o == null) {
            return
        }
        var d = this.MapUIXY(f.element);
        if (d == null) {
            return
        }
        var b = FakeButton_Find(f.element);
        if (b && ((b.className.indexOf("spinnerup") != -1) || (b.className.indexOf("spinnerdown") != -1))) {
            var k = this;
            var h = {};
            h.c = {
                f: function() {
                    var p = [];
                    var q = d.y;
                    k.mCurrentCol = d.x;
                    if (k.mPrimaryRowSelection == null || q != k.RowNoFromTag(k.mPrimaryRowSelection) || q != k.mLastRowSelection) {
                        p.push({
                            t: k,
                            f: k.ApplySelections
                        });
                        p.push({
                            f: k.SetPrimarySelection,
                            t: k,
                            a: [q, true, true, true]
                        })
                    }
                    return {
                        n: p
                    }
                }
            };
            h.n = {
                f: function() {
                    var p = [];
                    p.push({
                        t: k.mColFields[d.x],
                        f: k.mColFields[d.x].DOMMouseDown,
                        a: [f]
                    });
                    return {
                        n: p
                    }
                }
            };
            return h
        } else {
            var k = this;
            var h = {};
            h.c = {
                f: function() {
                    var p = [];
                    var q = d.y;
                    k.mCurrentCol = d.x;
                    if (k.mSelRow == 1) {
                        return {
                            n: p
                        }
                    }
                    if (f.shift) {
                        p.push({
                            t: k,
                            f: k.ApplySelections
                        });
                        p.push({
                            f: function() {
                                k.mLastRowSelection = q
                            },
                            t: k
                        });
                        if (k.mSelRow == 0) {
                            if (f.ctrl || f.meta) {
                                p.push({
                                    f: k.FillSelections,
                                    t: k,
                                    a: [k.mLastRowSelection, q, q, false]
                                })
                            } else {
                                p.push({
                                    f: k.FillSelections,
                                    t: k,
                                    a: [q, k.mLastNonShiftedRowSelection, k.mLastNonShiftedRowSelection < 0 ? q: k.mLastNonShiftedRowSelection, true]
                                })
                            }
                        }
                    } else {
                        if (k.mSelRow != 1 && !f.ctrl && !f.shift && !f.meta) {
                            if ((k.mRowSelections[k.mResult.r[k.mMouseDownRowSelection].i] != true) && (k.mPrimaryRowSelection == null || q != k.RowNoFromTag(k.mPrimaryRowSelection) || q != k.mLastRowSelection)) {
                                p.push({
                                    t: k,
                                    f: k.ApplySelections
                                });
                                p.push({
                                    f: k.SetPrimarySelection,
                                    t: k,
                                    a: [q, true, true, true]
                                })
                            }
                        }
                    }
                    return {
                        n: p
                    }
                }
            };
            return h
        }
    }
};
DPageArray.prototype.DOMDragStart = function(f) {
    if (f.ctrl) {
        var d = this.MapUIXY(f.element);
        if (d == null) {
            return
        }
        var g = d.y;
        if (this.mSelRow == 0) {
            var b = [];
            b.push({
                t: this,
                f: this.ApplySelections
            });
            b.push({
                f: function() {
                    this.mLastRowSelection = g
                },
                t: this
            });
            b.push({
                f: this.EORSelections,
                t: this,
                a: [g, true, false]
            });
            return {
                n: b
            }
        }
        return {}
    }
};
DPageArray.prototype.DOMMouseUp = function(f) {
    DPageArray.superclass.DOMMouseUp.call(this, f);
    if (this.GAccess() == 3) {
        return
    }
    var g = this.FindContainingDiv(f.element);
    if (g == null) {
        return
    }
    if (g.className != "TableHdr" && g.className != "TableFtr" && g != this.mChunkOuter) {
        g = f.element;
        while ((g != null) && (g.nodeType != 1 || g.getAttribute("id") != "pagerow")) {
            g = g.parentNode
        }
        if (g == null) {
            return
        }
        var d = this.MapUIXY(f.element);
        if (d == null) {
            return
        }
        var b = FakeButton_Find(f.element);
        if (b) {
            if ((b.className.indexOf("spinnerup") != -1) || (b.className.indexOf("spinnerdown") != -1)) {
                this.mColFields[d.x].DOMMouseUp(f)
            }
        }
    }
};
DPageArray.prototype.DOMMouseOver = function(b) {
    if (this.GAccess() == 3) {
        return
    }
    var d = this.FindContainingDiv(b.element);
    if (d == null) {
        return
    }
    if (d.className != "TableHdr" && d.className != "TableFtr" && d != this.mChunkOuter) {
        d = b.element;
        while ((d != null) && (d.nodeType != 1 || d.getAttribute("id") != "pagerow")) {
            d = d.parentNode
        }
        if (d == null) {
            return
        }
        if (d.style.borderWidth == "2px" && d.style.borderColor == "transparent") {
            d.className += " RolloverRound"
        } else {
            d.style.borderColor = "#339cde"
        }
    }
};
DPageArray.prototype.DOMMouseOut = function(f) {
    if (this.GAccess() == 3) {
        return
    }
    var g = this.FindContainingDiv(f.element);
    if (g == null) {
        return
    }
    if (g.className != "TableHdr" && g.className != "TableFtr" && g != this.mChunkOuter) {
        g = f.element;
        while ((g != null) && (g.nodeType != 1 || g.getAttribute("id") != "pagerow")) {
            g = g.parentNode
        }
        if (g == null) {
            return
        }
        if (g.className.indexOf("Round") != -1) {
            g.className = g.className.replace(/RolloverRound/g, "")
        } else {
            if (g.style.borderColor != "transparent") {
                g.style.borderColor = this.mPanelBorderColor
            }
        }
        g.className = g.className.replace(/\s+$/g, "");
        var d = this.MapUIXY(f.element);
        if (d == null) {
            return
        }
        var b = FakeButton_Find(f.element);
        if (b) {
            if ((b.className.indexOf("spinnerup") != -1) || (b.className.indexOf("spinnerdown") != -1)) {
                this.mColFields[d.x].DOMMouseOut(f)
            }
        }
    }
};
DPageArray.prototype.DOMKeyPress = function(d) {
    if (this.GAccess() == 3) {
        return
    }
    var f = this.FindContainingDiv(d.element);
    if (f == null) {
        return
    }
    if (f.className != "TableHdr" && f.className != "TableFtr" && f != this.mChunkOuter) {
        f = d.element;
        while ((f != null) && (f.nodeType != 1 || f.getAttribute("id") != "pagerow")) {
            f = f.parentNode
        }
        if (f == null) {
            return
        }
        var b = this.MapUIXY(d.element);
        if (b == null) {
            return
        }
        f = d.element;
        if ((f.className.indexOf("text") != -1) && (f.getAttribute("arautoc") != null)) {
            this.mColFields[b.x].DOMKeyPress(d)
        }
    }
};
DPageArray.prototype.SyncCaret = function(f, h) {
    var k = this.FishOutTR(h);
    if (k == null) {
        return
    }
    var g = this.TabableElementSelector(k);
    if (g == null) {
        var b = this.MapUIXY(f);
        var p = 0;
        if (b != null) {
            p = 0
        }
        var p = b.x;
        k = this.findHtmlObject(h, p);
        if (k == null) {
            return
        }
        g = k;
        while (true) {
            var o;
            if (g.firstChild && (!g.style || (g.style.visibility != "hidden" && g.style.display != "none"))) {
                g = g.firstChild
            } else {
                if (g == k) {
                    g = null;
                    return
                }
                while (!g.nextSibling) {
                    g = g.parentNode;
                    if (g == k) {
                        g = null;
                        return
                    }
                }
                g = g.nextSibling
            }
            if (g.nodeType == 1) {
                var d;
                if ((d = this.TabableElementSelector(g)) != null) {
                    if (d.className == f.className) {
                        g = d;
                        break
                    }
                }
            }
        }
    }
    if (g != null) {
        g.focus()
    }
};
DPageArray.prototype.DOMKeyDown = function(d) {
    if (this.GAccess() == 3) {
        return
    }
    var f = this.FindContainingDiv(d.element);
    if (f == null) {
        return
    }
    if (f.className != "TableHdr" && f.className != "TableFtr" && f != this.mChunkOuter) {
        f = d.element;
        while ((f != null) && (f.nodeType != 1 || f.getAttribute("id") != "pagerow")) {
            f = f.parentNode
        }
        if (f == null) {
            return
        }
        var b = this.MapUIXY(d.element);
        if (b == null) {
            return
        }
        f = d.element;
        if ((f.className.indexOf("text") != -1) && (f.getAttribute("arautoc") != null)) {
            this.mColFields[b.x].DOMKeyDown(d)
        } else {
            if (d.key == 13) {
                return
            } else {
                return DPageArray.superclass.DOMKeyDown.call(this, d)
            }
        }
    } else {
        return DPageArray.superclass.DOMKeyDown.call(this, d)
    }
};
DPageArray.prototype.DOMFocus = function(d) {
    if (this.GAccess() == 3) {
        return
    }
    var f = this.FindContainingDiv(d.element);
    if (f == null) {
        return null
    }
    if (f.className != "TableHdr" && f.className != "TableFtr" && f != this.mChunkOuter) {
        f = d.element;
        while ((f != null) && (f.nodeType != 1 || f.getAttribute("id") != "pagerow")) {
            f = f.parentNode
        }
        if (f == null) {
            return DPageArray.superclass.DOMFocus.call(this, d)
        }
        var b = this.MapUIXY(d.element);
        if (b == null) {
            return DPageArray.superclass.DOMFocus.call(this, d)
        }
        f = d.element;
        if ((f.className.indexOf("text") != -1) && (f.getAttribute("arautoc") != null)) {
            this.mColFields[b.x].DOMFocus(d)
        }
    }
    return DPageArray.superclass.DOMFocus.call(this, d)
};
DPageArray.prototype.FieldValChanged = function(d, g) {
    if (this.GAccess() == 3) {
        return
    }
    var f = this.FindContainingDiv(d.element);
    if ((f == null) || (f.className.indexOf("radio") != -1 && d.key == 9)) {
        return
    }
    if (f.className != "TableHdr" && f.className != "TableFtr" && f != this.mChunkOuter) {
        f = d.element;
        while ((f != null) && (f.nodeType != 1 || f.getAttribute("id") != "pagerow")) {
            f = f.parentNode
        }
        if (f == null) {
            return
        }
        var b = this.MapUIXY(d.element);
        if (b == null) {
            return
        }
        f = d.element;
        if (b.x >= 0) {
            this.mColFields[b.x].FieldValChanged(d, g)
        }
    }
};
DPageArray.prototype.ChangeDataColorForEnum = function(g, f) {
    for (var b in g.childNodes) {
        var h = g.childNodes[b];
        if (h.nodeType != 1 || (h.tagName != "DIV")) {
            continue
        }
        h.style.color = f;
        var d;
        if (h.getAttribute("artype") == "EnumSel") {
            d = h.childNodes[2].childNodes[1];
            d.style.color = f
        } else {
            if (h.getAttribute("artype") == "Enum") {
                d = h.childNodes[3].childNodes[3];
                d.style.color = f
            } else {
                d = h.childNodes[2];
                d.style.color = f
            }
        }
    }
};
DPageArray.prototype.HandleEnumSelValChanged = function(h, d) {
    if (this.GAccess() == 3) {
        return
    }
    this.FieldValChanged(h, d);
    return;
    var k = this.FindContainingDiv(h.element);
    if (k == null) {
        return
    }
    var g = k;
    if (k.className != "TableHdr" && k.className != "TableFtr" && k != this.mChunkOuter) {
        k = h.element;
        while ((k != null) && (k.nodeType != 1 || k.getAttribute("id") != "pagerow")) {
            k = k.parentNode
        }
        if (k == null) {
            return
        }
        var p = this.MapUIXY(h.element);
        if (p == null) {
            return
        }
        if (d == "" || d == null) {
            var f = 0
        } else {
            for (var q in this.mColFields[p.x].mObj.e) {
                var b = this.mColFields[p.x].mObj.e[q];
                if (b == d) {
                    var f = parseInt(q) + 1;
                    break
                }
            }
        }
        if (typeof f == "undefined") {
            return
        }
        if (this.mColours != null && f < this.mColours.length) {
            var o = "";
            if (this.mColours[f].indexOf("inherit") == -1) {
                o = this.mColours[f].replace(/ color:/, "").replace(/;/, "")
            }
            this.ChangeDataColorForEnum(k, o)
        } else {
            this.ChangeDataColorForEnum(k, "")
        }
        if (this.mBkgcolours != null && f < this.mBkgcolours.length) {
            if (this.mBkgcolours[f].indexOf("inherit") != -1) {
                k.style.backgroundColor = ""
            } else {
                k.style.backgroundColor = this.mBkgcolours[f].replace(/ background-color:/, "").replace(/;/, "")
            }
        } else {
            k.style.backgroundColor = ""
        }
    }
};
DPageArray.prototype.HandleEnumValChanged = function(d, o) {
    if (this.GAccess() == 3) {
        return
    }
    this.FieldValChanged(d, o);
    return;
    var h = this.FindContainingDiv(d.element);
    if (h == null) {
        return
    }
    var f = h;
    if (h.className != "TableHdr" && h.className != "TableFtr" && h != this.mChunkOuter) {
        h = d.element;
        while ((h != null) && (h.nodeType != 1 || h.getAttribute("id") != "pagerow")) {
            h = h.parentNode
        }
        if (h == null) {
            return
        }
        var b = this.MapUIXY(d.element);
        if (b == null) {
            return
        }
        if (o == "" || o == null) {
            var k = 0
        } else {
            k = parseInt(o) + 1
        }
        if (this.mColours != null && k < this.mColours.length) {
            var g = "";
            if (this.mColours[k].indexOf("inherit") == -1) {
                g = this.mColours[k].replace(/ color:/, "").replace(/;/, "")
            }
            this.ChangeDataColorForEnum(h, g)
        }
        if (this.mBkgcolours != null && k < this.mBkgcolours.length) {
            if (this.mBkgcolours[k].indexOf("inherit") != -1) {
                h.style.backgroundColor = ""
            } else {
                h.style.backgroundColor = this.mBkgcolours[k].replace(/ background-color:/, "").replace(/;/, "")
            }
        } else {
            h.style.backgroundColor = ""
        }
    }
};
DPageArray.prototype.DOMDoubleClick = function(d) {
    var b = FakeButton_Find(d.element);
    if (b) {
        if ((b.className.indexOf("spinnerup") != -1) || (b.className.indexOf("spinnerdown") != -1)) {
            return
        }
    }
    var f = this.MapUIXY(d.element);
    if (f == null) {
        return
    }
    return this.ARDrillDown(f, false)
};
DPageArray.prototype.GetFocusElementForEvent = function(d) {
    var f = d.element;
    if (this.GetNestedFocusability()) {
        var g = this.FindContainingDiv(d.element);
        if (g == null) {
            return null
        }
        if (g.className != "TableHdr" && g.className != "TableFtr" && g.className != "TableHdrChunk") {
            if ((f.tagName == "A") || (f.tagName == "INPUT") || (f.tagName == "IMG") || (f.tagName == "TEXTAREA")) {
                var b = this.ColField_FromElement(d);
                if ((b != null) && this.GetNestedFocusabilityForColumn(b)) {
                    return f
                } else {
                    return null
                }
            } else {
                while (f && (f.nodeType != 1 || (f.tagName != "DIV" && f.tagName != "TR" && f.tagName != "FIELDSET"))) {
                    f = f.parentNode
                }
                if (f && ((f.className == "BaseTableColHeaders" || f.className == "BaseTableBar" || f.className == "BaseTableHeader") || (g.getAttribute("id") == "pagerow"))) {
                    return d.element
                }
            }
        } else {
            if ((f.tagName == "A") || (f.tagName == "INPUT") || (f.tagName == "IMG")) {
                return f
            }
        }
        f = d.element;
        while ((f != null) && (f.nodeType != 1 || f.getAttribute("id") != "pagerow")) {
            f = f.parentNode
        }
        if (f == null) {
            if (this.mOuter != null) {
                return this.mOuter
            }
            return this.mObj
        }
        return f
    }
};
DPageArray.prototype.TabableElementSelector = function(k) {
    if (k.tagName == "A") {
        var h = FakeButton_Find(k);
        if (h != null) {
            var g = k.parentNode;
            while (g && g.getAttribute("id") != "pagerow" && g.tagName != "TD") {
                g = g.parentNode
            }
            if (g && g.tagName == "TD") {
                return FakeButton_TabableElementSelector(h)
            } else {
                if (g && g == this.GetFocusElement()) {
                    return k
                }
            }
        } else {
            return null
        }
    } else {
        if (k.tagName == "TEXTAREA") {
            var g = k.parentNode;
            while (g && g.getAttribute("id") != "pagerow") {
                g = g.parentNode
            }
            if (g && g == this.GetFocusElement()) {
                return k
            }
        } else {
            if (k.tagName == "INPUT") {
                var g = k.parentNode;
                while (g && g.getAttribute("id") != "pagerow" && g.tagName != "TD") {
                    g = g.parentNode
                }
                if (g && g == this.GetFocusElement()) {
                    if (k.getAttribute("type") == "radio") {
                        if (k.checked) {
                            return k
                        } else {
                            var b = this.MapUIXY(k);
                            if (b == null) {
                                return null
                            }
                            var f = this.mColFields[b.x].mField;
                            if (f == null) {
                                return null
                            }
                            if (typeof f.mSelected == "undefined") {
                                f.initVariable(k);
                                if (f.mSelected != null) {
                                    return null
                                }
                            }
                            if (f.mSelected == null) {
                                var d = f.getFirst(k);
                                if (d != null && d.id == k.id) {
                                    return k
                                } else {
                                    return null
                                }
                            }
                        }
                    } else {
                        return k
                    }
                }
            }
        }
    }
    return null
};
DPageArray.prototype.ColField_FromElement = function(d) {
    var b = this.MapUIXY(d.element);
    if (b == null) {
        return
    }
    return this.mColFields[b.x]
};
DPageArray.prototype.GetNestedFocusabilityForColumn = function(b) {
    var d = b.GetParent();
    return ((b.GAccess() != 3) && b.GVis() && (d == null || d.GetNestedFocusability()))
};
DPageArray.prototype.MapUIX = function(d) {
    var f, g = null;
    var b = document.body;
    while (d && (d.getAttribute("id") != "pagerow") && (d != b)) {
        if ((d.tagName == "DIV" || d.tagName == "INPUT") && (d.className.indexOf("PageBody") == -1)) {
            g = d
        }
        if ((d.tagName == "A") && (d.getAttribute("artype") == "Control")) {
            g = d
        }
        d = d.parentNode
    }
    if (d == b) {
        return null
    }
    if (d && d.getAttribute("arrow") != null) {
        f = parseInt(d.getAttribute("arrow"))
    } else {
        return null
    }
    if (f >= this.mRowsPresent) {
        return null
    }
    return f
};
DPageArray.prototype.MapUIXY = function(f) {
    var g, b = 0,
    h = null;
    var d = document.body;
    while (f && (f.getAttribute("id") != "pagerow") && (f != d)) {
        if ((f.tagName == "DIV" || f.tagName == "INPUT") && (f.className.indexOf("PageBody") == -1)) {
            h = f
        }
        if ((f.tagName == "A") && (f.getAttribute("artype") == "Control")) {
            h = f
        }
        f = f.parentNode
    }
    if (f == d) {
        return null
    }
    if (f && f.getAttribute("arrow") != null) {
        g = parseInt(f.getAttribute("arrow"))
    } else {
        return null
    }
    if (g >= this.mRowsPresent) {
        return null
    }
    if (h == null) {
        b = -1
    } else {
        while (h.previousSibling) {
            h = h.previousSibling;
            if ((h.nodeType == 1) && (h.className.indexOf("FormContainerImage") == -1)) {++b
            }
        }
    }
    if (b >= this.mColCnt) {
        return null
    }
    return {
        y: g,
        x: b
    }
};
DPageArray.prototype.FishOutTR = function(b) {
    if (b < 0 || b >= this.mRowsPresent || this.mDataTableObj == null || this.mDataTableObj.childNodes.length <= 0) {
        return null
    }
    return this.mDataTableObj.childNodes[b]
};
DPageArray.prototype.ApplySelections = function() {
    var w = this.FishOutTR(0),
    s = {};
    var p = 0;
    if (w != null) {
        var h = -1;
        for (var k in this.mRowSelections) {
            if (!this.mResult.r[this.RowNoFromTag(k)].mXXXDirty || this.mResult.r[this.RowNoFromTag(k)].mXXXDirty != 3) {
                s[this.RowNoFromTag(k)] = "SelSecondary";
                if (w.style.borderWidth == "2px" && w.style.borderColor == "transparent") {
                    s[this.RowNoFromTag(k)] += "Round"
                }
                p++
            }
        }
        if (this.mPrimaryRowSelection != null) {
            h = this.RowNoFromTag(this.mPrimaryRowSelection);
            if (!this.mResult.r[h].mXXXDirty || this.mResult.r[h].mXXXDirty != 3) {
                s[h] = "SelPrimary";
                if (w.style.borderWidth == "2px" && w.style.borderColor == "transparent") {
                    s[h] += "Round"
                }
            }
        }
        var u = {},
        v = 0;
        for (var k in this.mLastRowSelections) {
            if (! (k in s)) {
                u[k] = ""; ++v
            }
        }
        for (var k in s) {
            if (s[k] != this.mLastRowSelections[k]) {
                u[k] = s[k]; ++v
            }
        }
        var d;
        if (v > 1750) {
            for (var o = 0; w; w = w.nextSibling, ++o) {
                if (o in u) {
                    w.className = u[o]
                } else {
                    w.className = ""
                }
            }
        } else {
            var q = w.parentNode,
            g = 0;
            outer: for (var k in u) {
                for (var f = 0; f < q.childNodes.length; f++) {
                    if (q.childNodes[parseInt(f) + g].getAttribute("arrow") == k) {
                        q.childNodes[parseInt(f) + g].className = u[k];
                        continue outer
                    }
                }
            }
        }
    }
    this.mLastRowSelections = s;
    if (this.mID == 1020 && this.mFtrRObj) {
        var b = getLocalizedMessage("{0} rows selected");
        b = b.replace(/\{0\}/, p);
        NodeWrite(this.mFtrRObj, b)
    }
};
DPageArray.prototype.DirtyEditableCell = function(b) {
    return
};
DPageArray.prototype.DataChanged = function() {
    if (this.mAsyncMode) {
        this.mAsyncDirty = (3 > this.mAsyncDirty ? 3 : this.mAsyncDirty)
    }
};
DPageArray.prototype.findHtmlObject = function(h, f) {
    var b = this.FishOutTR(h);
    if (b == null) {
        return null
    }
    var d = b.firstChild;
    if (d == null) {
        return null
    }
    while (d.nextSibling) {
        d = d.nextSibling;
        if (d.nodeType == 1) {
            break
        }
    }
    if (d == null) {
        return null
    }
    d = d.firstChild;
    var g = f;
    while (d) {
        if ((d.nodeType == 1) && (d.className.indexOf("FormContainerImage") == -1)) {
            if (g <= 0) {
                break
            }--g
        }
        d = d.nextSibling
    }
    return d
};
DPageArray.prototype.findHtmlInputObject = function(h, f) {
    var g = this.findHtmlObject(h, f);
    if (g == null) {
        return null
    }
    var d = this.TabableElementSelector(g);
    if (d == null) {
        d = g;
        while (true) {
            var k;
            if (d.firstChild && (!d.style || (d.style.visibility != "hidden" && d.style.display != "none"))) {
                d = d.firstChild
            } else {
                if (d == g) {
                    d = null;
                    return
                }
                while (!d.nextSibling) {
                    d = d.parentNode;
                    if (d == g) {
                        d = null;
                        return
                    }
                }
                d = d.nextSibling
            }
            if (d.nodeType == 1) {
                if (d.tagName != "IFRAME") {
                    var b;
                    if ((b = this.TabableElementSelector(d)) != null) {
                        d = b;
                        break
                    }
                } else {
                    d = window.frames[d.name];
                    break
                }
            }
        }
    }
    return d
};
DPageArray.prototype.SColLabel = function(b, d) {
    if (this.mFlushingQueue > 0) {
        this.SColFieldLabel(b, d)
    } else {
        this.mColInfo[b].heading = d;
        this.mAsyncQueue.push({
            action: 0,
            col: b,
            val: d
        });
        this.mAsyncDirty = (3 > this.mAsyncDirty ? 3 : this.mAsyncDirty)
    }
};
DPageArray.prototype.SColFieldLabel = function(b, d) {
    this.ApplyData()
};
DPageArray.prototype.getPageBox = function(k, d, h) {
    var q = k.height;
    var f = k.width;
    var o = k.top;
    var g = k.left;
    q = parseInt(q.substr(0, q.length - 2));
    f = parseInt(f.substr(0, f.length - 2));
    o = parseInt(o.substr(0, o.length - 2));
    g = parseInt(g.substr(0, g.length - 2));
    o += d;
    g += h;
    var b = o + q - 1;
    var p = g + f - 1;
    return {
        top: o,
        left: g,
        bottom: b,
        right: p
    }
};
DPageArray.prototype.getRowInScroll = function(q) {
    if (q.element.className == "BaseTableInner") {
        var g = this.mInner;
        var u = g.firstChild;
        var k = u.style.marginTop;
        var f = u.style.marginLeft;
        k = parseInt(k.substr(0, k.length - 2));
        f = parseInt(f.substr(0, f.length - 2));
        var y = u.childNodes;
        var d = y.length;
        var w = q.ox;
        var s = q.oy;
        for (var b = 0; b < d; b++) {
            var o = y[b].style;
            var h = new Object();
            var v = y[b].getAttribute("arrow");
            v = parseInt(v);
            h.height = o.height;
            h.width = o.width;
            h.top = o.top;
            h.left = o.left;
            var p = this.getPageBox(h, k, f);
            if ((w >= p.left && w <= p.right) && (s >= p.top && s <= p.bottom)) {
                return v
            }
        }
    }
    return null
};
DPageArray.prototype.Clearoutfields = function() {
    for (var b = 0; b < this.mColFields.length; ++b) {
        if (this.mColFields[b].mField) {
            this.mColFields[b].mField = null
        }
    }
};
DPageArray.prototype.setFieldVisibilityOnRow = function(g, o, f) {
    if (!this.mResult) {
        return
    }
    var p = 0;
    var d = 0;
    if (o && o > 0) {
        p = o - 1
    }
    if (f && f > 0) {
        d = f - 1
    }
    var b = this.mResult.f.length;
    var h = this.mResult.r.length;
    if ((p > h) || (d > b)) {
        return
    }
    this.mResult.r[p].d[d].h = g;
    var k = this.findHtmlObject(p, d);
    if (k) {
        if (g == "1") {
            k.style.visibility = "hidden"
        } else {
            k.style.visibility = "inherit"
        }
    }
};
DPageArray.prototype.setFieldVisibilityOnCurrentRow = function(f, q) {
    if (!this.mResult) {
        return
    }
    var k = this.mCurrentRow;
    var p = this.mResult.r.length;
    if (k > p) {
        return
    }
    var b = this.mResult.f.length;
    var o = 0;
    var d = q.split(/,/);
    for (var h = 0; h < d.length; h++) {
        o = this.getColNum(d[h]);
        if ((o > b) || (o < 0)) {
            continue
        }
        this.mResult.r[k].d[o].h = f;
        var g = this.findHtmlObject(k, o);
        if (g) {
            if (f == "1") {
                g.style.visibility = "hidden"
            } else {
                g.style.visibility = "inherit"
            }
        }
    }
};
DPageArray.prototype.mResetFocusToRowAfterRefresh = 0;
DPageArray.prototype.mResetFocusToColumnAfterRefresh = 0;
DPageArray.prototype.getFocusElementForReset = function(o, d, f) {
    if (!this.mResult) {
        return
    }
    var g = this.mResult.r.length;
    if ((o > g) || (o < 0)) {
        return
    }
    var b = this.mResult.f.length;
    if ((d > b) || (d < 0)) {
        return
    }
    var h = this.findHtmlInputObject(o, d);
    var k = h;
    if (k) {
        while (k != null && f != null && k.tagName != f.tagName) {
            k = k.nextSibling
        }
        if (k == null) {
            k = h
        }
    } else {
        k = f
    }
    return k
};
var gTreeMessages = new Object();
gTreeMessages[0] = getLocalizedMessage("{0}, Level {1} {2} Closed");
gTreeMessages[1] = getLocalizedMessage("Level {0} {1} Closed");
gTreeMessages[2] = getLocalizedMessage("{0}, Level {1} {2} Closed Disabled");
gTreeMessages[3] = getLocalizedMessage("Level {0} {1} Closed Disabled");
gTreeMessages[4] = getLocalizedMessage("{0}, Level {1} {2} Closed {3} of {4} {5} Items");
gTreeMessages[5] = getLocalizedMessage("Level {0} {1} Closed {2} of {3} {4} Items");
gTreeMessages[6] = getLocalizedMessage("{0}, Level {1} {2} Closed Disabled {3} of {4} {5} Items");
gTreeMessages[7] = getLocalizedMessage("Level {0} {1} Closed Disabled {2} of {3} {4} Items");
gTreeMessages[8] = getLocalizedMessage("{0}, Level {1} {2} {3} of {4}");
gTreeMessages[9] = getLocalizedMessage("Level {0} {1} {2} of {3}");
gTreeMessages[10] = getLocalizedMessage("{0}, Level {1} {2} {3} of {4} Disabled");
gTreeMessages[11] = getLocalizedMessage("Level {0} {1} {2} of {3} Disabled");
gTreeMessages[12] = getLocalizedMessage("{0} Selected");
gTreeMessages[13] = getLocalizedMessage("{0} Selected Disabled");
gTreeMessages[14] = getLocalizedMessage(" Selected");
gTreeMessages[15] = getLocalizedMessage("Closed");
gTreeMessages[16] = getLocalizedMessage("Opened");
var gTreeMsgArgs = new Object();
gTreeMsgArgs[0] = "[treeNode.imgalt, treeNode.nodeLevel, treeNode.name]";
gTreeMsgArgs[1] = "[treeNode.nodeLevel, treeNode.name]";
gTreeMsgArgs[2] = "[treeNode.imgalt, treeNode.nodeLevel, treeNode.name]";
gTreeMsgArgs[3] = "[treeNode.nodeLevel, treeNode.name]";
gTreeMsgArgs[4] = "[treeNode.imgalt, treeNode.nodeLevel, treeNode.name, childNum, numSiblings, treeNode.childs.length]";
gTreeMsgArgs[5] = "[treeNode.nodeLevel, treeNode.name, childNum, numSiblings, treeNode.childs.length]";
gTreeMsgArgs[6] = "[treeNode.imgalt, treeNode.nodeLevel, treeNode.name, childNum, numSiblings, treeNode.childs.length]";
gTreeMsgArgs[7] = "[treeNode.nodeLevel, treeNode.name, childNum, numSiblings, treeNode.childs.length]";
gTreeMsgArgs[8] = "[treeNode.imgalt, treeNode.nodeLevel, treeNode.name, childNum, numSiblings]";
gTreeMsgArgs[9] = "[treeNode.nodeLevel, treeNode.name, childNum, numSiblings]";
gTreeMsgArgs[10] = "[treeNode.imgalt, treeNode.nodeLevel, treeNode.name, childNum, numSiblings]";
gTreeMsgArgs[11] = "[treeNode.nodeLevel, treeNode.name, childNum, numSiblings]";
gTreeMsgArgs[12] = "[nodetitle.title]";
gTreeMsgArgs[13] = "[nodetitle.title]";
gTreeMsgArgs[14] = "[]";
gTreeMsgArgs[16] = "[]";
gTreeMsgArgs[15] = "[]";
TreeNode.showRootNode = false;
TreeNode.showLines = true;
TreeNode.sortNodes = false;
TreeNode.documentID = window.location.href;
TreeNode.showAllNodesOnStartup = false;
var TreeNodes = {};
TreeNode.NextIndex = 0;
TreeNode.href = "";
TreeNode.prototype.constructor = TreeNode;
function TreeNode(o, g, f, d, s, q, p, b, k, u, h) {
    if (arguments.length) {
        this.init(o, g, f, d, s, q, p, b, k, u, h)
    }
}
TreeNode.prototype.init = function(p, g, f, d, u, s, q, b, o, v, k) {
    var h = arguments.length;
    this.addMessageStrings(p, g);
    this.id = arguments[2];
    this.name = (arguments[3] == null ? "unset name": arguments[3]);
    this.nodeLevel = arguments[4];
    this.disabled = arguments[5];
    this.childs = new Array();
    this.color = (h >= 7) ? arguments[6] : "";
    this.imgref = (h >= 8) ? arguments[7] : "";
    this.imgalt = (h >= 9) ? arguments[8] : null;
    this.imgh = (h >= 10) ? arguments[9] : 0;
    this.imgw = (h >= 11) ? arguments[10] : 0;
    this.nullnodetype = 0
};
TreeNode.prototype.addMessageStrings = function(b, d) {
    this.treeMessages = b;
    this.treeMsgArgs = d
};
TreeNode.prototype.parent = null;
TreeNode.prototype.linestring = "";
TreeNode.prototype.nextSibling = null;
TreeNode.prototype.prevSibling = null;
TreeNode.prototype.startRow = 0;
TreeNode.prototype.endRow = 0;
TreeNode.prototype.column = -1;
TreeNode.registerRootNode = function(b) {
    b.selectedNode = null;
    b.statearray = new Array();
    b.loaded = false;
    TreeNodes[b.id] = b
};
TreeNode.prototype.getMsg = function(d, b) {
    var f = this.treeMessages[d];
    return subArgsMessages(f, b)
};
TreeNode.prototype.getMsgArgS = function(b) {
    return (this.treeMsgArgs[b])
};
TreeNode.prototype.getID = function() {
    return this.id
};
TreeNode.prototype.setName = function(b) {
    this.name = b
};
TreeNode.prototype.getName = function() {
    return this.name
};
TreeNode.prototype.setNullNodeType = function(b) {
    this.nullnodetype = b
};
TreeNode.prototype.getNullNodeType = function() {
    return this.nullnodetype
};
TreeNode.prototype.addChild = function(d) {
    var b = this.childs[this.childs.length - 1];
    if (b) {
        b.nextSibling = d;
        d.prevSibling = b
    }
    this.childs[this.childs.length] = d;
    d.setParent(this)
};
TreeNode.prototype.removeChild = function(d) {
    var f = false;
    for (var b = 0; b < this.childs.length; b++) {
        if (f) {
            this.childs[b] = this.childs[b + 1]
        }
        if (this.childs[b] == d) {
            if (b == (this.childs.length - 1)) {
                this.childs[b] = null
            } else {
                this.childs[b] = this.childs[b + 1]
            }
            f = true
        }
    }
    if (f) {
        this.childs.length = this.childs.length - 1
    }
};
TreeNode.prototype.makeThisFirstChild = function() {
    var g = this.getParent();
    var h, b, f;
    if (g.hasChilds() && g.childs[0] == this) {
        return
    } else {
        h = this;
        h.prevSibling = null;
        f = this.nextSibling
    }
    for (var d = 0; d < g.childs.length; d++) {
        if (g.childs[d] == this) {
            h.nextSibling = f;
            g.childs[d] = h;
            break
        } else {
            b = g.childs[d];
            g.childs[d] = h;
            h.nextSibling = b;
            b.prevSibling = h;
            h = b
        }
    }
};
TreeNode.prototype.getNodeElement = function() {
    return document.getElementById("title" + this.id)
};
TreeNode.prototype.resetChilds = function() {
    this.childs = new Array()
};
TreeNode.prototype.hasChilds = function() {
    return (this.childs.length > 0)
};
TreeNode.prototype.getChildCount = function() {
    return this.childs.length
};
TreeNode.prototype.getFirstChild = function() {
    if (this.hasChilds()) {
        return this.childs[0]
    }
    return null
};
TreeNode.prototype.getChildren = function() {
    return this.childs
};
TreeNode.prototype.setParent = function(b) {
    this.parent = b
};
TreeNode.prototype.getParent = function() {
    return this.parent
};
TreeNode.prototype.getLineString = function() {
    return this.linestring
};
TreeNode.prototype.setLineString = function(b) {
    this.linestring = b
};
TreeNode.getRootNode = function(d) {
    var b = d.split("_");
    if (b.length > 0) {
        return TreeNodes[b[0]]
    } else {
        return null
    }
};
TreeNode.getTreeNode = function(d) {
    var b = TreeNode.getRootNode(d);
    if (b == null) {
        return null
    }
    return TreeNode.findNodeWithID(b, d)
};
TreeNode.findNodeWithID = function(d, g) {
    if (g == null) {
        return null
    }
    if (d.getID() == g) {
        return d
    } else {
        if (d.hasChilds()) {
            for (var b = 0; b < d.getChildCount(); b++) {
                var f = TreeNode.findNodeWithID(d.childs[b], g);
                if (f != null) {
                    return f
                }
            }
        }
        return null
    }
};
TreeNode.prototype.getState = function() {
    return TreeNode.getState(this.getID())
};
TreeNode.getState = function(f) {
    var b = TreeNode.getRootNode(f);
    for (var d = 0; d < b.statearray.length; d++) {
        if (b.statearray[d]["key"] == f) {
            state = b.statearray[d]["state"];
            if (state == null || state == "") {
                state = "closed"
            }
            return state
        }
    }
    return "closed"
};
TreeNode.writeStates = function(h, d) {
    var b = TreeNode.getRootNode(h);
    var k = "";
    var g = false;
    for (var f = 0; f < b.statearray.length; f++) {
        if (b.statearray[f]["key"] == h) {
            b.statearray[f]["state"] = d;
            g = true
        }
        if (b.statearray[f]["state"] != null) {
            k += b.statearray[f]["key"] + "|" + b.statearray[f]["state"] + ";"
        }
    }
    if (g == false) {
        b.statearray[b.statearray.length] = new Array();
        b.statearray[b.statearray.length - 1]["key"] = h;
        b.statearray[b.statearray.length - 1]["state"] = d;
        if (d != null) {
            k += h + "|" + d + ";"
        }
    }
};
var markup, imgOpenNoRootTags, imgOpenNoRootLastTags, imgOpenTags, imgOpenLastTags, imgLineTagsF, imgLineTagsE, imgWhiteTags, imgTTagsF, imgTTagsE, imgTNoRootTags, imgLastnodeTagsF, imgLastnodeTagsE;
var imgTags;
var TREEIMG_H = 16;
var TREEIMG_W = 16;
var IMGREF_ICO_REP = "_imgref_ico_";
TreeNode.showTree = function(f, d, h) {
    TreeNode.href = h;
    var g = '<img class="treeimgicon treeimgsize" alt="" src="' + TreeNode.href;
    var b = '<img class="treeimgicon treeimgsize" alt="_imgref_ico_" src="' + TreeNode.href;
    imgTags = b + 'images/twisty-right-blue.gif"';
    imgWhiteTags = g + 'images/white.gif">';
    markup = [];
    if (f.hasChilds()) {
        for (i = 0; i < f.childs.length; i++) {
            TreeNode.showNode(f, f.childs[i], (i == (f.childs.length - 1)), i + 1, f.childs.length, true)
        }
    } else {
        markup.push("<html></html>")
    }
    var k = markup.join("");
    d.innerHTML = k;
    f.loaded = true
};
TreeNode.prototype.isLoaded = function() {
    return this.loaded
};
TreeNode.prototype.scaleImgHW = function(d, o) {
    var b = {
        h: d,
        w: o
    };
    if (d <= TREEIMG_H && o <= TREEIMG_W) {
        return b
    }
    var g = d + 0;
    var q = o + 0;
    var h = TREEIMG_H / g;
    var p = TREEIMG_W / q;
    g = g * h;
    q = q * p;
    var f = Math.round(g);
    var k = Math.round(q);
    b.h = f;
    b.w = k;
    return b
};
TreeNode.prototype.whichAccMsgIcon = function() {
    var b = 0;
    if (this.imgref != null && this.imgref.length > 0) {
        if (!this.disabled) {
            b = 0
        } else {
            b = 2
        }
    } else {
        if (!this.disabled) {
            b = 1
        } else {
            b = 3
        }
    }
    return b
};
TreeNode.showNode = function(rootNode, treeNode, lastNode, childNum, numSiblings, expandChildren) {
    var tag = "div";
    linestring = treeNode.linestring;
    markup.push("<");
    markup.push(tag);
    markup.push(' id="node');
    markup.push(treeNode.id);
    markup.push('"><nobr>');
    for (var y = 0; y < linestring.length; y++) {
        if (linestring.charAt(y) == "I") {
            markup.push(imgWhiteTags)
        } else {
            if (linestring.charAt(y) == "B") {
                markup.push(imgWhiteTags)
            }
        }
    }
    var imageTags = null;
    var imageAsLink = true;
    if (treeNode.hasChilds()) {
        imageTags = imgTags;
        var imgalt = "";
        imageTags = imageTags.replace(IMGREF_ICO_REP, imgalt)
    } else {
        imageTags = imgWhiteTags;
        imageAsLink = false
    }
    if (imageAsLink) {
        markup.push('<a href="javascript:" class="btn treeimg" title="');
        var msgIdIcon = treeNode.whichAccMsgIcon();
        markup.push(treeNode.getMsg(msgIdIcon, eval(treeNode.getMsgArgS(msgIdIcon))));
        markup.push('" id="link');
        markup.push(treeNode.id);
        markup.push('">');
        markup.push(imageTags);
        markup.push(' id="handler');
        markup.push(treeNode.id);
        markup.push('">');
        markup.push("</a>")
    } else {
        markup.push(imageTags)
    }
    markup.push('<a href="javascript:"');
    if (!treeNode.hasChilds()) {
        markup.push(treeNode.color)
    }
    if (treeNode.disabled) {
        markup.push(' class="btn treetitledisabled')
    } else {
        markup.push(' class="btn treetitle')
    }
    if (treeNode.id.indexOf("0_-1") > 0) {
        markup.push(" treeroot")
    }
    markup.push('"');
    markup.push(' ID="title');
    markup.push(treeNode.id);
    markup.push('">');
    var imgref = treeNode.imgref;
    if (imgref != null && imgref.length > 0) {
        var hw = treeNode.scaleImgHW(treeNode.imgh, treeNode.imgw);
        imgref = imgref.replace("{0}", hw.h + "");
        imgref = imgref.replace("{1}", hw.w + "");
        markup.push(imgref)
    }
    markup.push(treeNode.name);
    markup.push("</a></nobr>");
    markup.push("</");
    markup.push(tag);
    markup.push(">");
    if (treeNode.hasChilds()) {
        markup.push("<");
        markup.push(tag);
        markup.push(' id="node');
        markup.push(treeNode.id);
        markup.push('sub" style="display:');
        markup.push((TreeNode.showAllNodesOnStartup == true ? "block;": "none;"));
        markup.push("visibility:");
        markup.push((TreeNode.showAllNodesOnStartup == true ? 'inherit;"': 'hidden;"'));
        markup.push(">");
        var newChar = "";
        if (!lastNode) {
            newChar = "I"
        } else {
            newChar = "B"
        }
        var n = treeNode.childs.length;
        for (var z = 0; z < n; z++) {
            treeNode.childs[z].linestring = linestring + newChar
        }
        if (expandChildren) {
            for (var z = 0; z < n; z++) {
                TreeNode.showNode(rootNode, treeNode.childs[z], (z == (n - 1)), z + 1, n, false)
            }
            treeNode.loaded = true
        }
        markup.push("</");
        markup.push(tag);
        markup.push(">")
    } else {
        markup.push("<");
        markup.push(tag);
        markup.push(' id="node');
        markup.push(treeNode.id);
        markup.push('sub" style="display:none;visibility:hidden;"></');
        markup.push(tag);
        markup.push(">")
    }
};
TreeNode.selectNodeByID = function(k) {
    var h = TreeNode.getTreeNode(k);
    var d = TreeNode.getRootNode(k);
    if (h == null || d == null || !d.loaded) {
        return
    }
    if (d.selectedNode != null) {
        if (d.selectedNode == k) {
            return
        }
        var b = document.getElementById("title" + d.selectedNode);
        var p = TreeNode.getSelectedNode(d);
        var g = "btn treetitle";
        if (p && p.disabled) {
            g = "btn treetitledisabled"
        }
        if (b.id.indexOf("0_-1") > 0) {
            g += " treeroot"
        }
        b.className = g;
        b.parentNode.parentNode.className = "";
        if (b.previousSibling.tagName == "A") {
            b.previousSibling.className = "btn treeimg"
        }
    }
    d.selectedNode = k;
    var o = document.getElementById("title" + d.selectedNode);
    var f = "btn treetitleselectedfocused";
    if (h.disabled) {
        f = "btn treetitleselectedfocuseddisabled"
    }
    if (o.id.indexOf("0_-1") > 0) {
        f += " treeroot"
    }
    o.className = f;
    o.parentNode.parentNode.className = f;
    if (o.previousSibling.tagName == "A") {
        o.previousSibling.className += f
    }
    this.makeNodeVisible(h)
};
TreeNode.makeNodeVisible = function(d) {
    var b = TreeNode.getRootNode(d.id);
    for (d = d.getParent(); d != b && d != null; d = d.getParent()) {
        if (TreeNode.getState(d.id) == "closed") {
            TreeNode.handleNode(d.id)
        }
    }
};
TreeNode.handleNode = function(h) {
    var g = TreeNode.getTreeNode(h);
    if (!g.hasChilds()) {
        return
    }
    var f = document.getElementById("node" + h + "sub");
    if (!g.loaded) {
        markup = [];
        var b = TreeNode.getRootNode(h);
        for (i = 0; i < g.childs.length; i++) {
            TreeNode.showNode(b, g.childs[i], (i == (g.childs.length - 1)), i + 1, g.childs.length, false)
        }
        f.innerHTML = markup.join("");
        g.loaded = true
    }
    var d = document.getElementById("handler" + h);
    var k = false;
    if (d.src.indexOf("_no_root") != -1) {
        k = true
    }
    if (f.style.display == "none") {
        TreeNode.writeStates(h, "open");
        f.style.display = "block";
        f.style.visibility = "inherit";
        d.src = TreeNode.href + "images/twisty-down-blue.gif"
    } else {
        TreeNode.writeStates(h, "closed");
        f.style.display = "none";
        f.style.visibility = "hidden";
        d.src = TreeNode.href + "images/twisty-right-blue.gif"
    }
};
TreeNode.expandNode = function(f, d) {
    if (TreeNode.getState(f.id) == "closed") {
        TreeNode.handleNode(f.id)
    }
    if (d) {
        for (var b = 0; b < f.childs.length; b++) {
            TreeNode.expandNode(f.childs[b], true)
        }
    }
};
TreeNode.expandAll = function(b) {
    if (b != null && b.loaded) {
        for (var d = 0; d < b.childs.length; d++) {
            TreeNode.expandNode(b.childs[d], true)
        }
    }
};
TreeNode.collapseNode = function(f, d) {
    if (TreeNode.getState(f.id) == "open") {
        TreeNode.handleNode(f.id)
    }
    if (d) {
        for (var b = 0; b < f.childs.length; b++) {
            TreeNode.collapseNode(f.childs[b], true)
        }
    }
};
TreeNode.collapseAll = function(b) {
    if (b != null && b.loaded) {
        for (var d = 0; d < b.childs.length; d++) {
            TreeNode.collapseNode(b.childs[d], true)
        }
    }
};
TreeNode.getSelectedNode = function(b) {
    return TreeNode.findNodeWithID(b, b.selectedNode)
};
TreeNode.getSelectedNodeID = function(b) {
    return b.selectedNode
};
TreeNode.getParentNode = function(d) {
    var b = d;
    if (d.id.indexOf("title") == 0) {
        b = d.parentNode.parentNode
    } else {
        if (d.id.indexOf("handler") == 0) {
            b = d.parentNode.parentNode.parentNode
        } else {
            if (d.id.indexOf("timg") == 0) {
                b = d.parentNode.parentNode.parentNode
            } else {
                if (d.id.indexOf("link") == 0) {
                    b = d.parentNode.parentNode.parentNode
                } else {
                    if (d.id == "") {
                        b = d.parentNode.parentNode
                    }
                }
            }
        }
    }
    return b
};
TreeNode.prototype.getNextSibling = function() {
    var d = this.getParent();
    if (d != null) {
        for (var b = 0; b < d.childs.length; b++) {
            if (d.childs[b] == this && b + 1 < d.childs.length) {
                return d.childs[b + 1]
            }
        }
    }
    return null
};
TreeNode.prototype.changeLabel = function(b) {
    var d = document.getElementById("title" + this.id);
    if (d) {
        d.innerHTML = b
    }
    this.name = b
};
TreeNode.handleSingleClick = function(b) {
    var d = b.id;
    if (d.indexOf("title") == 0) {
        TreeNode.selectNodeByID(d.substring(5))
    } else {
        if (d.indexOf("handler") == 0) {
            TreeNode.selectNodeByID(d.substring(7));
            TreeNode.handleNode(d.substring(7))
        } else {
            if (d.indexOf("link") == 0) {
                TreeNode.selectNodeByID(d.substring(4));
                TreeNode.handleNode(d.substring(4))
            } else {
                if (d.indexOf("timg") == 0) {
                    TreeNode.selectNodeByID(d.substring(4));
                    TreeNode.handleNode(d.substring(4))
                } else {
                    if (d.indexOf("node") == 0) {
                        TreeNode.selectNodeByID(d.substring(4))
                    } else {
                        if (d == "") {
                            TreeNode.selectNodeByID(TreeNode.getParentNode(b).id.substring(4))
                        } else {
                            return false
                        }
                    }
                }
            }
        }
    }
    return true
};
TreeNode.handleDoubleClick = function(b) {
    var d = b.id;
    if (d.indexOf("title") == 0) {
        TreeNode.handleNode(d.substring(5))
    } else {
        if (d.indexOf("timg") == 0) {
            TreeNode.handleNode(d.substring(4))
        }
    }
};
TreeNode.prototype.ClearSelection = function() {
    if (this.selectedNode != null) {
        var b = document.getElementById("title" + this.selectedNode);
        var f = TreeNode.getTreeNode(this.selectedNode);
        var d = "btn treetitle";
        if (f && f.disabled) {
            d = "btn treetitledisabled"
        }
        if (b.id.indexOf("0_-1") > 0) {
            d += " treeroot"
        }
        b.className = d;
        b.parentNode.parentNode.className = "";
        if (b.previousSibling.tagName == "A") {
            b.previousSibling.className = "btn treeimg"
        }
    }
    this.selectedNode = null
};
TreeNode.handleMouseOver = function(d) {
    var b = TreeNode.getParentNode(d);
    if (b.id.indexOf("node") == -1) {
        return false
    }
    if (b.className == "") {
        b.className = "btn treetitlerollover";
        b.firstChild.lastChild.className += " treetitlerollover";
        if (b.firstChild.lastChild.previousSibling.tagName == "A") {
            b.firstChild.lastChild.previousSibling.className += " treetitlerollover"
        }
    } else {
        if (b.className.indexOf("treetitleselectedfocused") != -1) {
            b.className += " treetitleselectedrollover";
            b.firstChild.lastChild.className += " treetitleselectedrollover";
            if (b.firstChild.lastChild.previousSibling.tagName == "A") {
                b.firstChild.lastChild.previousSibling.className += " treetitleselectedrollover"
            }
        }
    }
};
TreeNode.handleMouseOut = function(d) {
    var b = TreeNode.getParentNode(d);
    if (b.id.indexOf("node") == -1) {
        return false
    }
    if (b.className.indexOf("treetitlerollover") != -1) {
        b.className = "";
        b.firstChild.lastChild.className = b.firstChild.lastChild.className.replace(/treetitlerollover/g, "");
        b.firstChild.lastChild.className = b.firstChild.lastChild.className.replace(/\s+$/g, "");
        if (b.firstChild.lastChild.previousSibling.tagName == "A") {
            b.firstChild.lastChild.previousSibling.className = b.firstChild.lastChild.previousSibling.className.replace(/treetitlerollover/g, "");
            b.firstChild.lastChild.previousSibling.className = b.firstChild.lastChild.previousSibling.className.replace(/\s+$/g, "")
        }
    } else {
        if (b.className.indexOf("treetitleselectedrollover") != -1) {
            b.className = b.className.replace(/treetitleselectedrollover/g, "");
            b.className = b.className.replace(/\s+$/g, "");
            b.firstChild.lastChild.className = b.firstChild.lastChild.className.replace(/treetitleselectedrollover/g, "");
            b.firstChild.lastChild.className = b.firstChild.lastChild.className.replace(/\s+$/g, "");
            if (b.firstChild.lastChild.previousSibling.tagName == "A") {
                b.firstChild.lastChild.previousSibling.className = b.firstChild.lastChild.previousSibling.className.replace(/treetitleselectedrollover/g, "");
                b.firstChild.lastChild.previousSibling.className = b.firstChild.lastChild.previousSibling.className.replace(/\s+$/g, "")
            }
        }
    }
};
TreeNode.expandCurrentNode = function(d, f, g, b) {
    var h = g.getState();
    if (h == "open") {
        if (g.hasChilds()) {
            TreeNode.selectNodeByID(g.childs[0].getID())
        }
    } else {
        TreeNode.handleNode(g.id);
        TreeNode.selectNodeByID(g.id)
    }
    if (!b) {
        return
    }
    var k = F(d, b.mParentField);
    while (k) {
        if (k instanceof DPage && k.mFillModel && k.mState == 1 && k.mFit) {
            k.getChildScroll(b)
        }
        k = k.GetParent()
    }
};
TreeNode.collapseCurrentNode = function(b, d) {
    var g = d.getState();
    if (g == "closed") {
        var f = d.getParent();
        if (f != null && f != b) {
            TreeNode.selectNodeByID(f.getID())
        }
    } else {
        TreeNode.handleNode(d.id);
        TreeNode.selectNodeByID(d.id)
    }
};
TreeNode.selectPrevNode = function(b, d) {
    if (d.prevSibling != null) {
        var f = TreeNode.getState(d.prevSibling.getID());
        if (f == "open" && d.prevSibling.hasChilds()) {
            var g = d.prevSibling.childs[d.prevSibling.childs.length - 1];
            var h = "open";
            while (g.hasChilds() && (TreeNode.getState(g.getID()) == "open")) {
                g = g.childs[g.childs.length - 1]
            }
            TreeNode.selectNodeByID(g.getID())
        } else {
            TreeNode.selectNodeByID(d.prevSibling.getID())
        }
    } else {
        if (d.getParent() != null && d.getParent() != b) {
            TreeNode.selectNodeByID(d.getParent().getID())
        }
    }
};
TreeNode.selectNextNode = function(b, d) {
    var g = d.getState();
    if (g == "open" && d.hasChilds()) {
        TreeNode.selectNodeByID(d.childs[0].getID())
    } else {
        if (d.nextSibling != null) {
            TreeNode.selectNodeByID(d.nextSibling.getID())
        } else {
            var f = d;
            while ((f = f.getParent()) != b) {
                if (f.nextSibling != null) {
                    TreeNode.selectNodeByID(f.nextSibling.getID());
                    break
                }
            }
        }
    }
};
TreeNode.SetFocusToSelectedNode = function(d) {
    var b = document.getElementById("title" + d.selectedNode);
    if (b != null) {
        d.focusTimer = setTimeout(function() {
            try {
                b.focus()
            } catch(f) {}
        },
        10)
    }
};
TreeNode.ClearFocusTimer = function(b) {
    if (b.focusTimer != null) {
        clearTimeout(b.focusTimer);
        b.focusTimer = null
    }
};
TreeNode.prototype.SetFocus = function() {
    var b = document.getElementById("title" + this.id);
    if (b != null) {
        setTimeout(function() {
            b.focus()
        },
        10)
    }
};
var gMenuMessages = new Object();
gMenuMessages[0] = getLocalizedMessage("Sub Menu {0} Closed");
gMenuMessages[2] = getLocalizedMessage("Sub Menu {0} Closed Disabled");
gMenuMessages[1] = getLocalizedMessage("Sub Menu {0} Closed");
gMenuMessages[3] = getLocalizedMessage("Sub Menu {0} Closed Disabled");
gMenuMessages[4] = getLocalizedMessage("Sub Menu {0} Closed");
gMenuMessages[6] = getLocalizedMessage("Sub Menu {0} Closed Disabled");
gMenuMessages[5] = getLocalizedMessage("Sub Menu {0} Closed");
gMenuMessages[7] = getLocalizedMessage("Sub Menu {0} Closed Disabled");
gMenuMessages[8] = getLocalizedMessage("{0}");
gMenuMessages[10] = getLocalizedMessage("{0} Disabled");
gMenuMessages[9] = getLocalizedMessage("{0}");
gMenuMessages[11] = getLocalizedMessage("{0} Disabled");
gMenuMessages[12] = getLocalizedMessage("{0}");
gMenuMessages[13] = getLocalizedMessage("{0} Disabled");
gMenuMessages[14] = getLocalizedMessage("");
gMenuMessages[15] = getLocalizedMessage("Closed");
gMenuMessages[16] = getLocalizedMessage("Opened");
var gMenuMsgArgs = new Object();
gMenuMsgArgs[0] = "[treeNode.name]";
gMenuMsgArgs[1] = "[treeNode.name]";
gMenuMsgArgs[2] = "[treeNode.name]";
gMenuMsgArgs[3] = "[treeNode.name]";
gMenuMsgArgs[4] = "[treeNode.name]";
gMenuMsgArgs[5] = "[treeNode.name]";
gMenuMsgArgs[6] = "[treeNode.name]";
gMenuMsgArgs[7] = "[treeNode.name]";
gMenuMsgArgs[8] = "[treeNode.name]";
gMenuMsgArgs[9] = "[treeNode.name]";
gMenuMsgArgs[10] = "[treeNode.name]";
gMenuMsgArgs[11] = "[treeNode.name]";
gMenuMsgArgs[12] = "[nodetitle.title]";
gMenuMsgArgs[13] = "[nodetitle.title]";
gMenuMsgArgs[14] = "[]";
gMenuMsgArgs[15] = "[]";
gMenuMsgArgs[16] = "[]";
MenuNode.prototype = new TreeNode();
MenuNode.prototype.constructor = MenuNode;
MenuNode.superclass = TreeNode.prototype;
function MenuNode(o, d, k, b, g, f, h) {
    if (arguments.length) {
        this.init(o, d, k, b, g, f, h)
    }
}
MenuNode.prototype.init = function(o, d, k, b, g, f, h) {
    MenuNode.superclass.init.call(this, o, d, k, b, g, f);
    this.mtReturnValue = h
};
MenuNode.HandleBoxPopupKeyEvents = function(g, b, o) {
    var h, d;
    if (b) {
        h = b.target || b.srcElement;
        d = b.keyCode
    } else {
        return false
    }
    var p = TreeNode.getSelectedNodeID(g);
    var f;
    if (h != null && h.id != null) {
        f = TreeNode.getTreeNode(h.id.replace("title", ""));
        if (f == null) {
            return
        }
    }
    if (d == 37) {
        TreeNode.collapseCurrentNode(g, f)
    } else {
        if (d == 38) {
            TreeNode.selectPrevNode(g, f)
        } else {
            if (d == 39) {
                TreeNode.expandCurrentNode(g, f)
            } else {
                if (d == 40) {
                    TreeNode.selectNextNode(g, f)
                } else {
                    if (d == 32) {
                        TreeNode.selectNodeByID(f.getID())
                    } else {
                        if (d == 13) {
                            TreeNode.selectNodeByID(f.getID());
                            if (!f.hasChilds()) {
                                o.close = true
                            }
                        } else {
                            if (d == 9) {
                                return true
                            } else {
                                return
                            }
                        }
                    }
                }
            }
        }
    }
    var k = TreeNode.getSelectedNodeID(g);
    if (p != k) {
        var q = TreeNode.getSelectedNode(g);
        TreeNode.SetFocusToSelectedNode(g)
    }
};
JAttachment.prototype = new Field();
JAttachment.prototype.constructor = JAttachment;
JAttachment.superclass = Field.prototype;
function JAttachment(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
JAttachment.prototype.init = function(g, f, d) {
    JAttachment.superclass.init.call(this, g, f, d)
};
JAttachment.prototype.G = function() {
    return this.mObj.v
};
JAttachment.prototype.DoSet = JAttachment.prototype.DoSLoadEntry = function(b) {
    if (b instanceof AttachmentType) {
        if (this.mObj.msz && (b.mOrigSize > this.mObj.msz)) {
            throw new WorkflowException(this.windowID, 0, [{
                t: 2,
                n: 9210,
                m: null,
                a: null
            }])
        }
        this.mObj.v = b
    } else {
        if (b instanceof CharType) {} else {
            this.mObj.v = Null
        }
    }
    this.updateDisplay();
    this.SetDirty()
};
JAttachment.prototype.mHaveStoredData = true;
JAttachment.fileDOSPathParser = /[A-Za-z]:(\\([^\\]+))+$/;
JAttachment.fileUnixPathParser = /(\/([^\/]+))+$/;
JAttachment.fileNetworkPathParser = /\\(\\([^\\]+))+$/;
JAttachment.prototype.updateDisplay = function() {
    if (!this.mObj.hdn) {
        var d = getFields_NS(this.windowID)[this.mObj.pnt];
        var h;
        var b;
        if (this.mObj.v.isNull) {
            h = b = ""
        } else {
            h = this.mObj.v.mFileName;
            var f = h.match(JAttachment.fileDOSPathParser);
            if (f) {
                h = f[2]
            }
            f = h.match(JAttachment.fileUnixPathParser);
            if (f) {
                h = f[2]
            }
            f = h.match(JAttachment.fileNetworkPathParser);
            if (f) {
                h = f[2]
            }
            b = parseInt(this.mObj.v.mOrigSize);
            if (b > 0) {
                var g = b >> 10;
                if (b & 1023) {
                    g++
                }
                b = g
            }
            b += " KB"
        }
        d.LoadRowContents(this.mID, h, b)
    }
};
JAttachment.prototype.Clear = function(b) {
    var d = this.mID;
    if ((d >= 1000000 && d <= 1999999) || (d >= 3000000 && d <= 3999999) || d == 1576 || d == 1575) {
        return
    }
    this.mObj.v = Null;
    this.updateDisplay();
    this.SetDirty()
};
JAttachment.prototype.setFromAddPopup = function(d, b) {
    this.mFromAddValue = b
};
JAttachment.SUCCESS = new IntegerType(0);
JAttachment.CANCELLED = new IntegerType(1);
JAttachment.FAILED = new IntegerType(2);
JAttachment.prototype.Add = function(b) {
    if (typeof b == "undefined") {
        b = {}
    }
    if (this.mObj.v.isNull) {
        return this.AddP1(b)
    } else {
        var d = {};
        var f = getLocalizedMessage("Would you like to replace {0} with new file?", null, "Attachment").replaceArgs(this.mObj.v.mFileName);
        return {
            c: {
                f: ConfirmPopup,
                a: [this.windowID, f, d, 4 | 8]
            },
            n: {
                t: this,
                f: function() {
                    if (("v" in d.result) && d.result.v == 1) {
                        return this.AddP1(b)
                    }
                }
            }
        }
    }
};
JAttachment.prototype.AddP1 = function(b) {
    var h = new Array();
    var g = AttachmentType.getKeyForCurrentField(this.mID, this.windowID);
    var k = 0;
    if (this.mObj && this.mObj.msz) {
        k = this.mObj.msz
    }
    var f = this.GLabel();
    h.push({
        akey: g,
        max: k,
        alabel: f,
        afid: this.mID
    });
    var d = AttachmentPopup(this.windowID, b, "PopupSF", getLocalizedMessage("File Name", null, "Attachment"), h);
    this.mFromAddValue = null;
    return {
        i: 1,
        n: {
            t: this,
            f: this.AddP2,
            a: [b]
        }
    }
};
JAttachment.prototype.AddP2 = function(b) {
    var d = b.result;
    var g = 0;
    if (d.v != -1 && d instanceof Object) {
        for (var f in d) {
            this.setFromAddPopup(d[f].id, new AttachmentType(d[f].v + ""));
            if (this.mFromAddValue != null) {
                this.AddP3(b);
                g++
            }
        }
        if (g == 0) {
            b.result = JAttachment.CANCELLED
        }
    } else {
        b.result = JAttachment.FAILED
    }
};
JAttachment.prototype.AddP3 = function(b) {
    this.mObj.v = this.mFromAddValue;
    this.updateDisplay();
    if (! ("mDCF" in this)) {
        this.mDCF = (this.mObj && "dcf" in this.mObj) ? (this.mObj.dcf == 1) : false
    }
    this.SetDirty();
    this.mFromAddValue = null;
    if (b) {
        b.result = JAttachment.SUCCESS
    }
};
JAttachment.prototype.Delete = function(b) {
    if (!this.mObj.v.isNull) {
        this.mObj.v = Null;
        this.updateDisplay();
        this.SetDirty();
        if (b) {
            b.result = JAttachment.SUCCESS
        }
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
};
JAttachment.displayHTML = '<html><head><title>{0}</title></head><body onload=document.forms["ARDF12"].submit()><FORM name=ARDF12 id=ARDF12 method="GET" enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" action="{1}"><input type=hidden name="{2}" value="{3}"/></FORM></body></html>';
JAttachment.prototype.Display = function(b) {
    if (!this.mObj.v.isNull) {
        var h = getLocalizedMessage("Display Attachment", null, "Attachment");
        var f = window.open((AbsContextPath + "resources/html/Blank.html"), "_blank", "toolbar=no,location=no,resizable=yes,scrollbars=yes,title=" + h);
        WorkflowContext.WindowOpened(this.windowID);
        f.document.open("text/html");
        var d = JAttachment.getAttachServletURL() + "/" + new Date().getTime();
        var g = JAttachment.getURLParams("1", this.mObj.v.mDataKey);
        f.document.write(JAttachment.displayHTML.replaceArgs(h, d, "ATTKey", g));
        f.document.close();
        if (b) {
            b.result = JAttachment.SUCCESS
        }
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
};
JAttachment.getURL = function(b) {
    return "{0}?{1}={2}".replaceArgs(JAttachment.getAttachServletURL(), "ATTKey", JAttachment.getURLParams("1", b))
};
JAttachment.getURLParams = function(h, f, d) {
    if (d) {}
    if (d) {
        var g = d;
        var b = d.length;
        g = g.HTMLEncode();
        return "{0}/{1}{2}/{3}{4}/{5}".replaceArgs(h.length, h, f.length, f, b, g)
    } else {
        return "{0}/{1}{2}/{3}".replaceArgs(h.length, h, f.length, f)
    }
};
JAttachment.saveHTML = '<FORM method="POST" action="{0}" enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" target="{1}"><input type=hidden name="{2}" value="{3}"/></FORM>';
JAttachment.prototype.SaveToDisk = function(b, d) {
    if (!this.mObj.v.isNull) {
        var o = window.document.createElement("DIV");
        o.style.top = 0;
        o.style.left = 0;
        o.style.zIndex = 100001;
        o.style.position = "absolute";
        o.style.display = "none";
        window.document.body.appendChild(o);
        var f = JAttachment.getAttachServletURL();
        var k = JAttachment.getSaveFrameTarget(this.mID);
        var g = JAttachment.getURLParams("2", this.mObj.v.mDataKey, d);
        var p = JAttachment.saveHTML.replaceArgs(f, k, "ATTKey", g);
        o.innerHTML = p;
        var h = o.firstChild;
        h.submit();
        window.document.body.removeChild(o);
        if (b) {
            b.result = JAttachment.SUCCESS
        }
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
};
JAttachment.ATTACH_SERVLET = null;
JAttachment.getAttachServletURL = function() {
    if (JAttachment.ATTACH_SERVLET == null) {
        JAttachment.ATTACH_SERVLET = (AbsContextPath + "servlet/AttachServlet")
    }
    return JAttachment.ATTACH_SERVLET
};
JAttachment.getSaveFrameTarget = function(d) {
    var b = "SaveToDiskIFrame" + d;
    if (window.frames[b] == null) {
        JAttachment.saveFrame = window.document.createElement("div");
        JAttachment.saveFrame.innerHTML = '<IFRAME name="{0}" onload=JAttachment.saveFrameLoaded(fid) src="javascript:&quot;&lt;HTML&gt;&lt;/HTML&gt;&quot;"></IFRAME>'.replaceArgs(b);
        JAttachment.saveFrame.style.display = "none";
        JAttachment.saveFrame.style.top = JAttachment.saveFrame.style.left = 0;
        JAttachment.saveFrame.style.bottom = JAttachment.saveFrame.style.right = 1;
        window.document.body.appendChild(JAttachment.saveFrame)
    }
    return b
};
JAttachment.saveFrameLoaded = function(h) {
    var g = window.frames[JAttachment.getSaveFrameTarget(h)];
    try {
        if (g.document && g.document.body) {
            if (g.document.location.href != "about:blank") {
                var d = g.window.Msg;
                if (!d) {
                    d = getLocalizedMessage("Failed to perform action")
                }
                ShowAlertPopup(d, getLocalizedMessage("Save Error"))
            }
        }
    } catch(b) {
        var f = WorkflowContext_StatusToString(b);
        ShowAlertPopup(f, getLocalizedMessage("Save Error"))
    }
};
DAttachmentPool.prototype = new SimpleTable();
DAttachmentPool.prototype.constructor = DAttachmentPool;
DAttachmentPool.superclass = SimpleTable.prototype;
DAttachmentPool.prototype.mHaveStoredData = false;
DAttachmentPool.prototype.MouseSelectable = false;
DAttachmentPool.prototype.mSortImgs = null;
DOMFieldFactories.AttachmentPool = function(b, f, d) {
    return new DAttachmentPool(b, f, d)
};
function DAttachmentPool(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DAttachmentPool.prototype.init = function(d, o, k) {
    DAttachmentPool.superclass.init.call(this, d, o, k, 2, false, this.InitData(k), this.InitButton(k));
    this.mAsyncResizePending = null;
    this.mHasChildFields = true;
    var h = this.getHoverEvtList();
    var g = false;
    var b = null;
    for (var f = 0; f < h.length; f++) {
        idx = f;
        b = AREventFunction(this.windowID, h[f], this.mID);
        if (b != null) {
            g = true;
            break
        }
    }
    if (!g) {
        g = this.hoverEvtonChildren()
    }
    this.mHasHoverEvt = g;
    getAttachPoolFields_NS(this.windowID).push(this)
};
DAttachmentPool.prototype.InitData = function(n) {
    var args = {};
    var arColWidth = parseInt(n.getAttribute("arcolw"));
    args.h = [n.getAttribute("arcol0"), n.getAttribute("arcol1"), n.getAttribute("arcol2")];
    args.w = [arColWidth, arColWidth, arColWidth];
    this.mIdRowMap = {};
    this.mRowIdMap = {};
    args.r = [];
    var arRows = eval(n.getAttribute("arrows"));
    for (var i = 0; i < arRows.length; ++i) {
        var row = [];
        var attLabel = (arRows[i].l == null || arRows[i].l == "") ? "&nbsp;": arRows[i].l;
        row.d = [{
            v: "&nbsp;"
        },
        {
            v: "&nbsp;"
        },
        {
            v: attLabel
        }];
        args.r.push(row);
        this.mIdRowMap[arRows[i].f] = row;
        this.mRowIdMap[i] = arRows[i].f
    }
    return args
};
DAttachmentPool.prototype.getHoverEvtList = function() {
    return [16777216]
};
DAttachmentPool.prototype.hoverEvtonChildren = function() {
    var f = false;
    for (var d = 0; d < this.mRowsPresent; d++) {
        var b = AREventFunction(this.windowID, 16777216, this.mRowIdMap[d]);
        if (b != null) {
            f = true;
            break
        }
    }
    return f
};
DAttachmentPool.prototype.InitButton = function(f) {
    var d = [];
    var b;
    b = f.getAttribute("aradd");
    if (b != null) {
        this.mBtnAdd = {
            name: b,
            loc: 0,
            bar: 1,
            func: this.Add
        };
        d.push(this.mBtnAdd)
    }
    b = f.getAttribute("ardelete");
    if (b != null) {
        this.mBtnDelete = {
            name: b,
            loc: 0,
            bar: 1,
            func: this.UIDelete
        };
        d.push(this.mBtnDelete)
    }
    b = f.getAttribute("ardisplay");
    if (b != null) {
        this.mBtnDisplay = {
            name: b,
            loc: 0,
            bar: 1,
            func: this.UIDisplay
        };
        d.push(this.mBtnDisplay)
    }
    b = f.getAttribute("arsave");
    if (b != null) {
        this.mBtnSave = {
            name: b,
            loc: 0,
            bar: 1,
            func: this.UISaveToDisk
        };
        d.push(this.mBtnSave)
    }
    b = f.getAttribute("ardeselect");
    if (b != null) {
        this.mBtnDeselect = {
            name: b,
            loc: 0,
            bar: 1,
            func: this.UIDeselect
        };
        d.push(this.mBtnDeselect)
    }
    return d
};
DAttachmentPool.prototype.GetValidRow = function() {
    if (this.mRowsPresent > 0) {
        for (var b = 0; b < this.mRowsPresent; ++b) {
            var d = this.mResult.r[b];
            if (d && d.d[0].v != "") {
                return b
            }
        }
    }
    return - 1
};
DAttachmentPool.prototype.GetEmptyRow = function() {
    if (this.mRowsPresent > 0) {
        for (var b = 0; b < this.mRowsPresent; ++b) {
            var d = this.mResult.r[b];
            if (d && d.d[0].v == "") {
                return b
            }
        }
    }
    return - 1
};
DAttachmentPool.prototype.GetEmptyRowIds = function() {
    var b = [];
    if (this.mRowsPresent > 0) {
        var g;
        for (var d = 0; d < this.mRowsPresent; ++d) {
            var f = this.mResult.r[d];
            if (f && f.d[0].v == "") {
                g = this.mRowIdMap[d];
                b.push(g)
            }
        }
    }
    return b
};
DAttachmentPool.prototype.getChildField = function(d) {
    var f = d.element;
    while (f.nodeType != 1 || (f.tagName != "DIV" && f.tagName != "TR")) {
        f = f.parentNode
    }
    if (f.tagName == "TR") {
        var b = this.MapUIXY(d.element);
        if (b == null) {
            return null
        }
        var g = b.y;
        var h = this.mRowIdMap[this.RowNoFromTag(g)];
        return h
    }
    return null
};
DAttachmentPool.prototype.isChild = function(f) {
    var d = false;
    for (var b = 0; b < this.mRowsPresent; b++) {
        if (this.mRowIdMap[b] == f) {
            d = true;
            break
        }
    }
    return d
};
DAttachmentPool.prototype.getIdInScroll = function(k) {
    if (k.element.className == "BaseTableInner") {
        var h = k.element;
        var o = h.firstChild;
        var s = o.rows;
        var f = s.length;
        posy = k.oy;
        var p = 0;
        var b = 0;
        for (var d = 0; d < f; d++) {
            b = p + s[d].clientHeight;
            if (posy >= p && posy <= b) {
                var q = s[d].getAttribute("arrow");
                q = parseInt(q);
                var g = this.mRowIdMap[this.RowNoFromTag(q)];
                return g
            }
            p = b
        }
    }
    return null
};
DAttachmentPool.prototype.GetHoverValue = function(d) {
    var b = null;
    if (d.element.className == "BaseTableInner") {
        b = this.getIdInScroll(d)
    } else {
        b = this.getChildField(d)
    }
    if (b == null) {
        return ""
    }
    var f = this.mIdRowMap[b];
    return f.d[0].v
};
DAttachmentPool.prototype.setFromAddPopup = function(d, b) {
    this.mFromAddID = d;
    this.mFromAddValue = b
};
DAttachmentPool.prototype.Add = function(s) {
    if (this.mPrimaryRowSelection != null) {
        var d = this.mRowIdMap[this.RowNoFromTag(this.mPrimaryRowSelection)];
        if (typeof s == "undefined") {
            s = {}
        }
        return F(this.windowID, d).Add(s)
    } else {
        var b = [];
        b = this.GetEmptyRowIds();
        if (b.length > 0) {
            if (typeof s == "undefined") {
                s = {}
            }
            var o = new Array();
            for (var q = 0; q < b.length; q++) {
                var p = AttachmentType.getKeyForCurrentField(b[q], this.windowID);
                var f = F(this.windowID, b[q]);
                var k = (f.mObj.msz) ? f.mObj.msz: 0;
                var h = f.GLabel();
                o.push({
                    akey: p,
                    msz: k,
                    alabel: h,
                    afid: b[q]
                })
            }
            var g = AttachmentPopup(this.windowID, s, "PopupSF", getLocalizedMessage("File Name", null, "Attachment"), o);
            this.mFromAddID = null;
            this.mFromAddValue = null;
            return {
                i: 1,
                n: {
                    t: this,
                    f: this.AddP2,
                    a: [s]
                }
            }
        } else {
            if (s) {
                s.result = JAttachment.FAILED
            }
        }
    }
};
DAttachmentPool.prototype.AddP2 = function(b) {
    var d = b.result;
    if (d.v != -1 && d instanceof Object) {
        var h = 0;
        for (var g in d) {
            this.setFromAddPopup(d[g].id, new AttachmentType(d[g].v + ""));
            if (this.mFromAddID != null && this.mFromAddValue != null) {
                var f = F(this.windowID, this.mFromAddID);
                f.S(this.mFromAddValue);
                this.mFromAddID = this.mFromAddValue = null;
                h++
            }
        }
        b.result = (h > 0) ? JAttachment.SUCCESS: JAttachment.FAILED
    } else {
        b.result = JAttachment.FAILED
    }
};
DAttachmentPool.prototype.Delete = function(b) {
    var f = this.GetValidRow();
    if (f > -1) {
        var d = this.mRowIdMap[f];
        F(this.windowID, d).Delete(b)
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
};
DAttachmentPool.prototype.UIDelete = function() {
    if (this.mPrimaryRowSelection != null) {
        var b = this.mRowIdMap[this.RowNoFromTag(this.mPrimaryRowSelection)];
        F(this.windowID, b).Delete()
    } else {}
};
DAttachmentPool.prototype.Display = function(b) {
    var f = this.GetValidRow();
    if (f > -1) {
        var d = this.mRowIdMap[f];
        F(this.windowID, d).Display(b)
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
};
DAttachmentPool.prototype.UIDisplay = function() {
    if (this.mPrimaryRowSelection != null) {
        var b = this.mRowIdMap[this.RowNoFromTag(this.mPrimaryRowSelection)];
        F(this.windowID, b).Display()
    } else {}
};
DAttachmentPool.prototype.SaveToDisk = function(b) {
    var f = this.GetValidRow();
    if (f > -1) {
        var d = this.mRowIdMap[f];
        F(this.windowID, d).SaveToDisk(b)
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
};
DAttachmentPool.prototype.UISaveToDisk = function() {
    if (this.mPrimaryRowSelection != null) {
        var b = this.mRowIdMap[this.RowNoFromTag(this.mPrimaryRowSelection)];
        F(this.windowID, b).SaveToDisk()
    } else {}
};
DAttachmentPool.prototype.UIDeselect = function() {
    this.ClearSelections(true);
    this.ApplyData()
};
DAttachmentPool.prototype.ApplyData = function() {
    DAttachmentPool.superclass.ApplyData.call(this);
    this.UpdateBtnVis()
};
DAttachmentPool.prototype.ResizeTo = function(f, b) {
    var d = Math.round(b * (this.perHeight / 100));
    var g = f;
    if (g < this.mMinWidth) {
        g = this.mMinWidth
    } else {
        if (g > this.mMaxWidth) {
            g = this.mMaxWidth
        }
    }
    if (d < this.mMinHeight) {
        d = this.mMinHeight
    } else {
        if (d > this.mMaxHeight) {
            d = this.mMaxHeight
        }
    }
    if (this.mAsyncMode) {
        this.mAsyncResizePending = {
            w: g,
            h: d
        };
        this.mAsyncDirty = (1 > this.mAsyncDirty ? 1 : this.mAsyncDirty)
    } else {
        this.Resize(g, d)
    }
};
DAttachmentPool.prototype.LoadRowContents = function(f, g, b) {
    var d = this.mIdRowMap[f];
    d.d[0] = {
        v: g
    };
    d.d[1] = {
        v: b
    };
    this.mAsyncDirty = (1 > this.mAsyncDirty ? 1 : this.mAsyncDirty);
    if (getCurWFC_NS(this.windowID) == null) {
        new WorkflowContext(this.windowID, [])
    }
};
DAttachmentPool.prototype.FlushAsyncQueue = function() {
    var b = 0;
    if (!this.mAsyncDirty) {
        return
    }
    if (this.mAsyncResizePending) {
        this.Resize(this.mAsyncResizePending.w, this.mAsyncResizePending.h)
    }
    this.mAsyncResizePending = null;
    this.ApplyData();
    b = this.getScrollheight();
    if (b > 0) {
        var d = F(this.windowID, this.mContainerID);
        while (d) {
            if (d instanceof DPage && d.mFillModel && d.mState == 1) {
                d.setDirty(b)
            }
            d = d.GetParent()
        }
    }
};
DAttachmentPool.prototype.UpdateVis = function(d) {
    var b = (this.mObj.style.visibility != "hidden");
    if (!b && d) {
        this.mObj.style.visibility = "inherit";
        this.SetAsync( - 1)
    } else {
        if (b && !d) {
            this.mObj.style.visibility = "hidden";
            this.SetAsync(1)
        }
    }
};
DAttachmentPool.prototype.SetBtnAccess = function(b) {
    if (this.mBtnAdd) {
        this.mBtnAdd.node.SetAccess(b)
    }
    if (this.mBtnDelete) {
        this.mBtnDelete.node.SetVisibility(b)
    }
    if (this.mBtnDisplay) {
        this.mBtnDisplay.node.SetVisibility(b)
    }
    if (this.mBtnSave) {
        this.mBtnSave.node.SetVisibility(b)
    }
    if (this.mBtnDeselect) {
        this.mBtnDeselect.node.SetVisibility(b)
    }
};
DAttachmentPool.prototype.ARRowSelected = DAttachmentPool.prototype.ARRowCleared = DAttachmentPool.prototype.UpdateBtnVis = function() {
    if ((getARStateCurrent_NS(this.windowID) == 4)) {
        this.SetBtnAccess(false)
    } else {
        var d = (this.mPrimaryRowSelection == null ? -1 : this.RowNoFromTag(this.mPrimaryRowSelection));
        if (d != -1) {
            var b = this.mResult.r[d];
            if (b && b.d[0].v != "") {
                this.SetBtnAccess(true);
                if ((getARStateCurrent_NS(this.windowID) == 1)) {
                    if (this.mBtnSave) {
                        this.mBtnSave.node.SetVisibility(false)
                    }
                }
                if ((getARStateCurrent_NS(this.windowID) == 3)) {
                    if (this.mBtnAdd) {
                        this.mBtnAdd.node.SetAccess(false)
                    }
                    if (this.mBtnDelete) {
                        this.mBtnDelete.node.SetVisibility(false)
                    }
                }
                return
            }
        }
        if (d != -1 || this.GetEmptyRow() != -1) {
            this.SetBtnAccess(false);
            if (! (getARStateCurrent_NS(this.windowID) == 3)) {
                if (this.mBtnAdd) {
                    this.mBtnAdd.node.SetAccess(true)
                }
            }
            if (d != -1) {
                if (this.mBtnDeselect) {
                    this.mBtnDeselect.node.SetVisibility(true)
                }
            }
            return
        }
        this.SetBtnAccess(false);
        if (this.mARRowSelection != 0) {
            if (this.mBtnDeselect) {
                this.mBtnDeselect.node.SetVisibility(true)
            }
        }
    }
};
DAttachmentPool.prototype.ARDrillDown = function(b, d) {
    if (this.mBtnDisplay) {
        this.UIDisplay()
    }
};
DAttachmentPool.prototype.SetRowSortOrder = function(f, d, g, b) {};
DAttachmentPool.prototype.Clear = function() {
    this.ClearSelections(true);
    for (var b = 0; b < this.mRowsPresent; ++b) {
        var d = this.mResult.r[b];
        if (d) {
            d.d[0].v = "";
            d.d[1].v = ""
        }
    }
    this.mAsyncDirty = (1 > this.mAsyncDirty ? 1 : this.mAsyncDirty)
};
DAttachmentPool.prototype.SetAsyncDirty = function() {
    this.mAsyncDirty = (1 > this.mAsyncDirty ? 1 : this.mAsyncDirty)
};
function DAttachmentPool_DoEntryChange(d, b) {
    var g = getAttachPoolFields_NS(d);
    for (var f = 0; f < g.length; ++f) {
        if (b) {
            g[f].ClearSelections(true)
        }
        g[f].SetAsyncDirty()
    }
}
DAttachmentPool.prototype.DOMFocus = function(d) {
    var b = [];
    if (d.element != null) {
        var f = -1;
        if (this.mPrimaryRowSelection != null) {
            f = this.mPrimaryRowSelection
        }
        f = (f < 0 && d.element.className.indexOf("Add") < 0 ? 0 : f);
        f = (f >= this.mRowsPresent ? this.mRowsPresent - 1 : f);
        b.push({
            t: this,
            f: DAttachmentPool.superclass.DOMFocus,
            a: [d]
        });
        if (f > -1) {
            b.push({
                t: this,
                f: this.ApplySelections,
                a: [true, false]
            });
            b.push({
                t: this,
                f: this.SetPrimarySelection,
                a: [f, true, true, true]
            })
        }
        return {
            n: b
        }
    }
    return DAttachmentPool.superclass.DOMFocus.call(this, d)
};
DAttachmentPool.prototype.DOMMouseDown = function(f) {
    if (this.GAccess() == 3) {
        return
    }
    var g = f.element;
    while (g.nodeType != 1 || (g.tagName != "DIV" && g.tagName != "TR")) {
        g = g.parentNode
    }
    if (g.tagName == "TR") {
        var d = [];
        var b = this.MapUIXY(f.element);
        if (b == null) {
            return
        }
        var h = b.y;
        this.mCurrentCol = b.x;
        if (this.mPrimaryRowSelection == null || h != this.RowNoFromTag(this.mPrimaryRowSelection)) {
            d.push({
                t: this,
                f: this.ApplySelections,
                a: [true, false]
            });
            d.push({
                f: this.SetPrimarySelection,
                t: this,
                a: [h, true, true, true]
            })
        }
        new WorkflowContext(this.windowID, d)
    }
};
DAttachmentPool.prototype.hasContextMenu = true;
DAttachmentPool.prototype.DOMContextMenu = function(b) {
    if ((getARStateCurrent_NS(this.windowID) == 4)) {
        return
    }
    Menu_Close();
    var d = new AttachmentContextMenu(this);
    var f = {
        x: b.ox,
        y: b.oy
    };
    return {
        n: {
            f: d.Open,
            t: d,
            a: [b.element, 4, f]
        }
    }
};
DAttachmentPool.prototype.getScrollheight = function() {
    var b = 0;
    var d = this.mParent.firstChild.childNodes[1];
    if (d.scrollHeight > d.offsetHeight) {
        b = d.scrollHeight - d.offsetHeight
    }
    return b
};
DAttachmentPool.prototype.GetUsedRowIds = function() {
    var b = [];
    if (this.mRowsPresent > 0) {
        var g;
        for (var d = 0; d < this.mRowsPresent; ++d) {
            var f = this.mResult.r[d];
            if (f && f.d[0].v != "") {
                g = this.mRowIdMap[d];
                b.push(g)
            }
        }
    }
    return b
};
Template.prototype.constructor = Template;
function Template(f, d, g, b) {
    if (arguments.length) {
        this.init(f, d, g, b)
    }
}
Template.prototype.init = function(g, d, h, b) {
    this.mName = g;
    this.mMarkUp = d;
    if (this.mName == null) {
        this.mName = ""
    }
    if (this.mMarkUp == null) {
        this.mMarkUp = ""
    }
    this.mProcessedMarkup = this.mMarkUp;
    this.mParameters = h;
    this.mFields = b;
    this.mParams = {};
    this.finalScript = [];
    this.mParamsRE = {};
    this.mFieldsRE = {};
    for (i in h) {
        this.mParams[h[i]] = "";
        this.mParamsRE[h[i]] = new RegExp("\\$\\{" + h[i] + "\\}", "g")
    }
    for (var f in this.mFields) {
        this.mFieldsRE[b[f]] = new RegExp("\\$" + b[f] + "\\$", "g");
        this.finalScript.push('this.replaceField("' + b[f] + '", (F(getCurrentWindowID_NS(),' + b[f] + ") != null)?F(getCurrentWindowID_NS()," + b[f] + ').G():"");')
    }
    getTemplates_NS()[g] = this;
    this.compileTemplate()
};
Template.prototype.setDefaultParamValues = function() {
    for (var b in this.mParameters) {
        this.mParams[this.mParameters[b]] = ""
    }
};
Template.prototype.replaceParams = function() {
    for (var b in this.mParams) {
        if (b == null) {
            continue
        }
        this.mProcessedMarkup = this.mProcessedMarkup.replace(this.mParamsRE[b], this.mParams[b])
    }
};
Template.prototype.replaceField = function(d, b) {
    if (b instanceof Datatype) {
        b = b.toString()
    }
    if (b == null) {
        b = ""
    }
    this.mProcessedMarkup = this.mProcessedMarkup.replace(this.mFieldsRE[d], b)
};
Template.prototype.S = function(d, b) {
    this.mParams[d] = b
};
Template.prototype.SF = function(b, d) {
    this.mFields[b] = d
};
Template.prototype.getValue = function() {
    return this.mProcessedMarkup
};
Template.prototype.compileTemplate = function() {
    var funcStr = this.finalScript.join("");
    eval("this.processFieldData=function(){" + funcStr + "}")
};
Template.prototype.process = function(windowID) {
    this.mProcessedMarkup = this.mMarkUp;
    this.replaceParams();
    if (arguments.length == 3) {
        var fields = arguments[1];
        var values = arguments[2];
        for (var i in fields) {
            this.replaceField(fields[i], values[i])
        }
        var statements = [];
        var found = false;
        for (var fld in this.mFieldsRE) {
            for (var num in fields) {
                if (fields[num] == fld) {
                    found = true;
                    break
                }
            }
            if (found == false) {
                statements.push('this.replaceField("' + fld + '", (F(' + windowID + "," + fld + ") != null)?F(" + windowID + "," + fld + ').G():"");')
            }
            found = false
        }
        if (statements.length > 0) {
            eval(statements.join(""))
        }
    } else {
        if (this.processFieldData) {
            this.processFieldData()
        }
    }
    return this.getValue()
};
var DummyTemplate = new Template("", "", [], []);
function T(b, d) {
    if (d == null) {
        d = ""
    }
    var g = (d in getTemplates_NS()) ? getTemplates_NS()[d] : null;
    if (g == null) {
        var f = new NDXGetARTemplate(b, ARKWGetStringByIdx(b, 7), d, RelContextPath);
        if (f && ("result" in f)) {
            g = f.result
        }
        if (!g) {
            g = DummyTemplate
        }
    }
    return g
}
function AttachmentPopup(f, y, k, q, s) {
    var o = 1 | 2;
    var p = getLocalizedMessage("Add Attachment");
    var g = getLocalizedMessage("Status");
    var v = "../../servlet/AttachServlet";
    var w = 175;
    if (s.length > 1) {
        w += (s.length - 1) * 20
    }
    var d = 400;
    var b = s[0].alabel.length;
    for (var h = 1; h < s.length; h++) {
        if (s[h].alabel.length > b) {
            b = s[h].alabel.length
        }
    }
    if (b > 20) {
        d += (b - 20) * 10
    }
    var u = "resources/html/AttachmentPopup.html";
    if (typeof enableAttachApplet !== "undefined" && enableAttachApplet) {
        w += 50;
        u = "resources/html/AttachmentAppletPopup.html"
    }
    return weOpenModalPopup(f, (AbsContextPath + u), "Attachment", {
        title: p,
        target: k,
        servlet: v,
        aInfo: s,
        btn: o,
        appss: GetAppStyleSheet("../../"),
        input: q,
        statusLabel: g
    },
    y, [d, w])
}
DTime.prototype = new DataField();
DTime.prototype.constructor = DTime;
DTime.superclass = DataField.prototype;
JTime.prototype = new Field();
JTime.prototype.constructor = JTime;
JTime.superclass = Field.prototype;
TPATime.prototype = new Field();
TPATime.prototype.constructor = TPATime;
TPATime.superclass = Field.prototype;
DOMFieldFactories.Time = function(b, f, d) {
    return new DTime(b, f, d)
};
function DTime(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DTime.prototype.init = function(b, f, d) {
    this.mInputNode = d.childNodes[2];
    DTime.superclass.init.call(this, b, f, d)
};
TPATime.prototype.ConvertPrimitiveToDataType = DTime.prototype.ConvertPrimitiveToDataType = function(d) {
    var b = this.FromUIInput(d, false, false);
    return b
};
DTime.prototype.GetQBEValue = function() {
    if (this.IsNullKeyword()) {
        return NullType.KEYWORD_NULL
    }
    var g = this.mInputNode.value;
    g = ExpandString(this.windowID, g, 2 | 4, this.mID, 7);
    g = g.trim(1 | 2);
    if (g == "") {
        return Null
    }
    var d = Field.GetQBEOperator(g);
    if (d == null) {
        var b = this.Validate();
        if (b) {
            throw (b)
        }
        return this.G()
    } else {
        var f = this.FromUIInput(g.substring(d.length).trim(1), true, false);
        return new CharType(d + f.toPrimitive())
    }
};
TPATime.prototype.FromUIInput = DTime.prototype.FromUIInput = function(k, h, g) {
    if (g) {
        k = ExpandString(this.windowID, k, 2 | 4, this.mID, 7)
    }
    k = k.trim(1 | 2);
    if (k == "") {
        return Null
    }
    var b = ARDate.parseDateTime(k);
    var f;
    if (b != null) {
        f = b.GTimestamp()
    }
    if (b == null || f < 0 || f > 2147483647) {
        if (h && !k.isNumeric()) {
            throw ({
                t: 2,
                n: 9376,
                m: null,
                a: this.GLabelOrName()
            })
        }
        f = parseInt(k, 10);
        if (isNaN(f)) {
            f = 0
        } else {
            if (f < 0) {
                f = 0
            } else {
                if (f > 2147483647) {
                    f = 2147483647
                }
            }
        }
    }
    var d = new TimeType(f);
    d.setDisplayFormat(this.mInputNode.getAttribute("ds"));
    return d
};
TPATime.prototype.ConvertDTForS = JTime.prototype.ConvertDTForS = DTime.prototype.ConvertDTForS = DTime.prototype.ConvertDTForSLE = function(d) {
    var b = this.mInputNode.getAttribute("ds");
    if (d.isNull || (d.type == 7 && !(d instanceof DateKWType) && d.getDisplayFormat() == b)) {
        return d
    } else {
        if (ARKWIsKeywordString(this.windowID, d)) {
            return new CharType(d.toString())
        } else {
            d = new TimeType(d.toTime().toString(b));
            d.setDisplayFormat(this.mInputNode.getAttribute("ds"));
            return d
        }
    }
};
DTime.prototype.Validate = function() {
    try {
        return Time_Validate(this, this.FromUIInput(this.mInputNode.value, true, true))
    } catch(b) {
        b.a = this.GLabel();
        return b
    }
};
DTime.prototype.mHaveStoredData = true;
DTime.prototype.mDataType = 7;
JFieldFactories.Time = function(b, f, d) {
    return new JTime(b, f, d)
};
function JTime(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
TPAFieldFactories.Time = function(b, f, d) {
    return new TPATime(b, f, d)
};
function TPATime(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
TPATime.prototype.G = JTime.prototype.G = function() {
    var b = this.mObj.v;
    if (b.isNull || b.type == 7) {
        return b
    } else {
        if (b.type == 4) {
            b = ExpandString(this.windowID, b.toString(), 2 | 4, this.mID, this.mDataType)
        }
        this.mObj.v = new TimeType(b);
        return this.mObj.v
    }
};
TPATime.prototype.DoSet = JTime.prototype.DoSet = function(d) {
    if (d.isNull) {
        this.mObj.v = Null
    } else {
        if (ARKWIsKeywordString(this.windowID, d)) {
            this.mObj.v = new CharType(d.toString())
        } else {
            d = d.toTime();
            this.mObj.v = d
        }
    }
    if (this.mInputNode != null) {
        var b;
        if (this.mObj.v.isNull) {
            b = ""
        } else {
            b = this.ConvertDTForS(this.mObj.v).toString()
        }
        this.mInputNode.value = b;
        this.mPrimVal = b;
        return
    }
    this.SetDirty()
};
TPATime.prototype.Validate = JTime.prototype.Validate = function() {
    return Time_Validate(this, this.G())
};
TPATime.prototype.ValidatePopupValue = JTime.prototype.ValidatePopupValue = DTime.prototype.ValidatePopupValue = function(d) {
    d = new TimeType(d.GTimestamp());
    var b = Time_Validate(this, d);
    if (b != null) {
        return {
            t: 2,
            n: 9307,
            m: null,
            a: "01/01/1970 - 01/19/2038 (GMT) : " + this.GLabelOrName()
        }
    }
    return null
};
TPATime.prototype.SetFromPopup = DTime.prototype.SetFromPopup = JTime.prototype.SetFromPopup = function(d) {
    if (this instanceof TPATime) {
        var b = new FormEvent(this.windowID, this.mParentid);
        b.element = this.mInputNode;
        getFields_NS(this.windowID)[this.mParentid].FieldValChanged(b, new TimeType(d.GTimestamp()))
    } else {
        this.S(new TimeType(d.GTimestamp()))
    }
};
function Time_Validate(d, f) {
    var b = d.mLastChanged && getField_LastCleared_NS(d.windowID) <= d.mLastChanged;
    if (!b) {
        return null
    }
    if (!f.isNull) {
        if (f.valueAdjusted) {
            return {
                t: 2,
                n: 9376,
                m: null,
                a: d.GLabelOrName()
            }
        }
    }
    return null
}
TPATime.prototype.mHaveStoredData = JTime.prototype.mHaveStoredData = true;
TPATime.prototype.GetSorter = JTime.prototype.GetSorter = function() {
    return "(ls=parseInt(lhs),rs=parseInt(rhs),(isNaN(ls)?0:ls)-(isNaN(rs)?0:rs))"
};
TPATime.prototype.FieldValChanged = function(b, f) {
    var d;
    if (f) {
        d = this.ConvertDTForS(f).toString()
    } else {
        d = this.GetScreenValAsPrimitive(b)
    }
    if (this.mPrimVal == d) {
        return
    }
    this.mPrimVal = d;
    if (d == "") {
        this.mDataVal = (this.mDataType == 7) ? TimeNull: Null
    } else {
        var g = {
            hasKeyword: false,
            hasTemporalKeyword: false
        };
        d = ExpandString(this.windowID, d, 2 | 4, this.mID, this.mDataType, g);
        if (g.hasTemporalKeyword) {
            this.mDataVal = null
        } else {
            if (d == "") {
                if (g.hasKeyword) {
                    this.mDataVal = (this.mDataType == 7) ? TimeNullType.KEYWORD_TIME_NULL: NullType.KEYWORD_NULL
                } else {
                    this.mDataVal = (this.mDataType == 7) ? TimerNull: Null
                }
            } else {
                this.mDataVal = this.ConvertPrimitiveToDataType(d)
            }
        }
    }
    this.DoSet(this.mDataVal)
};
TPATime.prototype.GetScreenValAsPrimitive = function(d) {
    if (this.mInputNode == null) {
        if (d == null) {
            return ""
        } else {
            var b = d.element.parentNode;
            this.mInputNode = b.childNodes[2];
            if (this.mInputNode == null) {
                return ""
            }
            this.mMaxLen = this.mInputNode.getAttribute("maxlen")
        }
    }
    return this.mInputNode.value
};
TPATime.prototype.DOMClick = DTime.prototype.DOMClick = function(f) {
    DTime.superclass.DOMClick.call(this, f);
    if (this.GAccess() == 3) {
        return
    }
    var k = FakeButton_Find(f.element);
    if (k) {
        if (k.className.indexOf("expand") != -1) {
            var d = null;
            if (this instanceof TPATime) {
                d = k.parentNode;
                this.mInputNode = d.childNodes[2]
            }
            var h = this.mInputNode.getAttribute("ds");
            var g = this.GAccess() == 1;
            if (getOpenDIVPopup_NS(this.windowID) && getOpenDIVPopup_NS(this.windowID).mModal) {
                return
            }
            var b = new TimePopup(this, h != 2, h != 1, false, g, d);
            b.SetOrigin(f);
            if (this instanceof TPATime) {
                return b.ShowPopup(k, 3, k.offsetHeight + 3)
            } else {
                return b.ShowPopup(k, 0, k.offsetHeight)
            }
        } else {
            this.mInputNode.focus()
        }
    }
};
TimePopup.prototype = new DIVPopup();
TimePopup.prototype.constructor = TimePopup;
TimePopup.superclass = DIVPopup.prototype;
function TimePopup(h, d, g, f, k, b) {
    if (arguments.length) {
        this.init(h, d, g, f, k, b)
    }
}
TimePopup.prototype.init = function(k, d, h, g, o, b) {
    this.mField = k;
    if (b != null) {
        var f = b.childNodes[3]
    } else {
        var f = k.mObj.childNodes[3]
    }
    TimePopup.superclass.init.call(this, k.windowID, true, true, false, false, true);
    this.mShowTime = d;
    this.mShowDate = h;
    this.mShowBC = g;
    this.mReadOnly = o;
    if (this.mReadOnly) {
        this.Buttons = [{
            t: getLocalizedMessage("Cancel"),
            f: "OnCancel"
        }]
    }
};
TimePopup.prototype.GetTitleBarHTML = function(b) {
    return ""
};
TimePopup.UpdateCalendar = function() {
    TimePopup.prototype.UpdateCalendar.call(getOpenDIVPopup_NS(getCurrentWindowID_NS()))
};
TimePopup.prototype.SetMonth = function(b) {
    this.mDateVal.SMonth(b);
    this.UpdateCalendar()
};
TimePopup.prototype.SetYear = function(d) {
    var f = this.mDateVal.GYear();
    var b = d * ((f < 0) ? -1 : 1);
    if (f < 0) {
        b++
    }
    this.mDateVal.SYear(b);
    this.UpdateCalendar()
};
TimePopup.UpdateDay = FormEvent.Trampoline(function(d) {
    var f = Window_FromElement(d.element);
    var b = d.element.getAttribute("day");
    if (b >= 0) {
        TimePopup.prototype.SetDay.call(getOpenDIVPopup_NS(f), b)
    }
});
TimePopup.Hover = FormEvent.Trampoline(function(d) {
    var b = d.element.style.backgroundColor = "#c1e1f5";
    d.element.onmouseout = function() {
        d.element.style.backgroundColor = ""
    }
});
TimePopup.prototype.PopupBodyStyle = "";
TimePopup.prototype.SetDay = function(b) {
    this.mDateVal.SDate(parseInt(b));
    this.UpdateCalendar();
    var d = this.windowID;
    setTimeout(function() {
        DIVPopup.InitFocus(d)
    },
    1)
};
TimePopup.prototype.UpdateCalendar = function() {
    var b = this.mDiv.getElementsByTagName("SPAN");
    for (var d = 0; d < b.length; d++) {
        if (b[d].id == "calendar") {
            b[d].innerHTML = this.GetMonthHTML();
            return
        }
    }
};
TimePopup.prototype.GetLastDayInMonth = function() {
    var b = new Date(this.mDateVal.GYear(), this.mDateVal.GMonth(), 1);
    b.setDate(32);
    return 32 - b.getDate()
};
TimePopup.prototype.GetMonthHTML = function() {
    var p = [];
    p.push('<table align="center" cellspacing=3 cellpadding=2><tr class="daysofweek">');
    for (var g = 0; g < 7; g++) {
        p.push('<th scope="col" class="day" align=center');
        p.push(">&nbsp;" + ARDate.DayShort(g).HTMLEncode() + "</th>")
    }
    p.push("</tr>");
    var o = 1 - new ARDate(this.mDateVal.GYear(), this.mDateVal.GMonth(), 1).GDay();
    var b = this.GetLastDayInMonth();
    for (var g = 0; g < 6; g++) {
        p.push('<tr arwindowid="' + this.windowID + '">');
        for (var f = 0; f < 7; f++) {
            var h = (o <= 0 || o > b) ? -1 : o;
            if (h > 0) {
                p.push('<td day="' + h + '" onmouseover="javascript:TimePopup.Hover(arguments[0]);" onclick="javascript:TimePopup.UpdateDay(arguments[0]);" class="');
                var k = new Date();
                if (h == k.getDate() && this.mDateVal.year == k.getFullYear() && this.mDateVal.month == k.getMonth()) {
                    p.push('calendaron" id="calenderon">')
                } else {
                    if (h == this.mDateVal.GDate()) {
                        p.push('selected" id="selected">')
                    } else {
                        if (f == 0 || f == 6) {
                            p.push('weekend">')
                        } else {
                            p.push('weekday">')
                        }
                    }
                }
                p.push(h + "</td>")
            } else {
                p.push("<td>&nbsp;</td>")
            }
            o++
        }
        p.push("</tr>")
    }
    p.push("</table>");
    return p.join("")
};
TimePopup.prototype.BuildCalendar = function() {
    var o = localeInfo.dateFormatPattern.charAt(0);
    var f = (o == "Y" || o == "y");
    var b = "100%";
    var k = '<table style="margin:-2px 0 0 -1px" ><tr class="header"><td><table style="width:' + b + '">';
    if (this.mShowDate) {
        var h = ARDate.MonthLabel(this.mDateVal.GMonth());
        var d = this.mDateVal.GYear();
        if (d <= 0) {
            d = Math.abs(d) + 1
        } else {
            d = Math.abs(d)
        }
        k += '<tr><td nowrap><table class="calendarTable"><tr><td><table class="fullwidth" cellpadding=0 cellspacing=0>';
        k += (f ? this.GetYearInput(d) : this.GetMonthDropDown(h));
        k += "<td width='5px'>&nbsp;</td>";
        k += (f ? this.GetMonthDropDown(h) : this.GetYearInput(d));
        if (this.mShowBC) {
            k += "<td>";
            k += "<input type=checkbox artb=1 ";
            if (this.mDateVal.GYear() <= 0) {
                k += "checked "
            }
            k += 'id="bc" name="bc" value="BC"></td><td nowrap>' + getLocalizedMessage("BC") + "</td>"
        }
        k += "</table></td></tr></table></td></tr></td></tr></table>";
        k += '<tr><td><span id="calendar">' + this.GetMonthHTML(); + "</span></td></tr>"
    }
    if (this.mShowTime) {
        if (!this.mShowDate) {
            var k = '<table style="width:' + b + '">'
        }
        k += '<tr height=50><td align="center"><div class="showTime">';
        this.militaryTime = localeInfo.timeFormatPattern.match(/[iI]/);
        var g = new TODType(this.mDateVal.GTimeOfDay());
        k += this.GetTimePopupHTML(g);
        k += "</div></td></tr>"
    }
    k += "</table>";
    this.SetContents(null, k)
};
TimePopup.prototype.GetYearInput = function(b) {
    return '<td height=24 cellpadding=0><input artb=1 id="popupyear" type="text" class="text" style="position:static;height:21px;width:45px" size=4 maxlength=4 value=\'' + b + "'></td>"
};
TimePopup.prototype.GetMonthDropDown = function(b) {
    var d = [];
    d.push('<td width=\'100%\' height=24><div style=\'position:relative;top:0;height:21px;width:100%;\'><input artb=1 id="popupmonth" readonly class="text" style="height:21px;width:100%"');
    d.push(' value="');
    d.push(b);
    d.push('"></INPUT><a class="btn btn3d selectionbtn" style="');
    d.push("right:0px");
    d.push(';height:21px;width:20px;"><img id="monthmenu"class="btnimg" alt="" src="');
    d.push(RelContextPath);
    d.push('resources/images/mt_sprites.gif"/>');
    d.push("</a>");
    d.push("</div></td>");
    return d.join("")
};
TimePopup.prototype.GetTimePopupHTML = function(f) {
    var d = f.getTimeObj();
    d.h = this.AdjustHour(d.h);
    var u = localeInfo.AMPM[0];
    if (!f.isNull && f.toInteger() >= (12 * 3600)) {
        u = localeInfo.AMPM[1]
    }
    var q = [];
    q.A = '<td><input artb=1 id="meridiem" class="text" style="position:relative; height:20px; ; width:25px; max-width: 25px" type="text" value="' + u + '" size=3 maxlength=2 > </td>';
    q.H = '<td><input artb=1 id="hr" class="text" style="position:relative; height:20px; width:20px; max-width: 20px" type="text" value="' + d.h + '" size=2 maxlength=2 > </td>';
    q.I = q.H;
    q.U = '<td><input artb=1 id="min" class="text" style="position:relative; height:20px; width:20px; max-width: 20px" type="text" value="' + ARDate.zeroPad(d.m) + '" size=2 maxlength=2 > </td>';
    q.S = '<td><input artb=1 id="sec" class="text" style="position:relative; height:20px; width:20px; max-width: 20px" type="text" value="' + ARDate.zeroPad(d.s) + '" size=2 maxlength=2 > </td>';
    var v = '<td><div class="label f9" style="position:relative">' + localeInfo.timeSeparator + "</div> </td>";
    var k = [];
    var g = localeInfo.timeFormatPattern.split(/[^asSuUiIhH]+/);
    for (var h = 0; h < g.length; h++) {
        var b = g[h].toUpperCase();
        if (b.length > 0) {
            if (b.match(/[U|S]/)) {
                k.push(v)
            }
            k.push(q[b])
        }
    }
    var s = [];
    s.push('<td><table><tr><td><a href="javascript:" id="up" class="btn btn3d spinnerup">');
    s.push('<img id="up" alt="" class="btnimg" src="' + RelContextPath + 'resources/images/mt_sprites.gif"></a></td></tr>');
    s.push('<tr><td><a href="javascript:" id="down" class="btn btn3d spinnerdown">');
    s.push('<img id="down" alt="" class="btnimg" src="' + RelContextPath + 'resources/images/mt_sprites.gif"></a></td></tr></table></td>');
    k.push(s.join(""));
    return '<table align="center"><tr>' + k.join("") + "</tr></table>"
};
TimePopup.prototype.ShowPopup = function(h, d, b) {
    var k = Null;
    var g = new Object();
    if (this.mField.Validate() != null) {
        var f;
        if (!this.mShowDate) {
            f = 9379
        } else {
            f = 9380
        }
        g.c = {
            f: MessagePopup,
            a: [this.windowID, new Array({
                n: f,
                t: 1,
                m: null,
                a: null
            })]
        }
    } else {
        k = this.mField.G()
    }
    g.n = {
        f: function(s, p) {
            var q = new ARDate();
            if (p.isNull) {
                q.STimestamp(new Date().UnixTimestamp());
                q.SHour(0);
                q.SMinute(0);
                q.SSecond(0)
            } else {
                if (p instanceof TODType) {
                    var u = p.getTimeObj();
                    q.STimestamp((new ARDate(1970, 1, 1, u.h, u.m, u.s)).GTimestamp())
                } else {
                    if (p instanceof DateType) {
                        q.SDays(p.toInteger())
                    } else {
                        q.STimestamp(new TimeType(p).toInteger())
                    }
                }
            }
            s.mDateVal = q;
            s.BuildCalendar();
            TimePopup.superclass.ShowPopup.call(s, h, d, b, true)
        },
        a: [this, k]
    };
    return g
};
TimePopup.prototype.InitFocus = function() {
    var b = this.mDiv.getElementsByTagName("INPUT");
    for (var f = 0; f < b.length; f++) {
        if (b[f].id == "popupmonth") {
            b[f].focus()
        }
    }
    for (var g = 0; g < b.length; g++) {
        b[g].prototype.isSelected = false
    }
    if (this.mShowDate) {
        var d = this.mDiv.getElementsByTagName("SPAN");
        if (!d) {
            return
        }
        for (var g = 0; g < d.length; g++) {
            if (d[g].id == "calendar") {
                var h = d[g].getElementsByTagName("TD");
                for (var f = 0; f < h.length; f++) {
                    if (h[f].id == "calendaron") {
                        if ("focus" in h[f]) {
                            h[f].focus()
                        }
                    }
                }
            }
        }
    } else {
        if (this.mShowTime) {
            if (b && b.length > 0) {
                if ("focus" in b[0]) {
                    b[0].focus()
                }
            }
        }
    }
};
TimePopup.prototype.KeyPress = function(b) {
    return false
};
TimePopup.prototype.KeyDown = function(k) {
    if (k.key == 9) {
        return TimePopup.superclass.KeyDown.call(this, k)
    }
    var h = k.element,
    d = h.id;
    var u = k.key;
    var w = h.value;
    if (k.key == 13) {
        h.click();
        return false
    }
    if (d == "hr" || d == "min" || d == "sec") {
        if (w.indexOf("0") == 0) {
            w = w.substring(1)
        }
        var f = parseInt(w);
        var A = String.fromCharCodeWithNumPad(u);
        var o = parseInt(A);
        if (isNaN(o)) {
            o = 0
        }
        h.value = (d == "hr") ? this.Validate_Hour(f, o, u) : (d == "min") ? ARDate.zeroPad(this.Validate_Min(f, o, u)) : (d == "sec") ? ARDate.zeroPad(this.Validate_Sec(f, o, u)) : w
    } else {
        if (d == "popupyear") {
            if (u == 46) {
                h.value = "";
                return false
            }
            var f = (w == "" ? 0 : parseInt(w));
            if (u == 38 || u == 40) {
                var s = f + ((u == 38) ? 1 : -1);
                s = Math.max(1, s);
                h.value = s;
                this.SetYear(s)
            } else {
                var o = parseInt(String.fromCharCodeWithNumPad(u));
                if (!isNaN(o)) {
                    var b = h.selectionStart,
                    g = h.selectionEnd;
                    h.value = h.value.substr(0, b) + o + h.value.substr(g);
                    h.setSelectionRange(b + 1, b + 1);
                    this.SetYear(h.value)
                }
            }
        } else {
            if (d == "meridiem") {
                h.value = this.Validate_Meridiem(w)
            } else {
                if (h.className.indexOf("calendaron") != -1 && (u == 38 || u == 40 || u == 37 || u == 39)) {
                    var g = this.GetLastDayInMonth();
                    var q = this.mDateVal.GDate();
                    if (u == 38 || u == 40) {
                        q += (u == 38) ? -7 : 7;
                        if (q <= 0) {
                            q = 35 + q;
                            if (q > g) {
                                q -= 7
                            }
                        }
                        if (q > g) {
                            q = q - 35;
                            if (q <= 0) {
                                q += 7
                            }
                        }
                    } else {
                        if (u == 37 || u == 39) {
                            q += (u == 37) ? -1 : 1;
                            if (q > g) {
                                q = 1
                            } else {
                                if (q <= 0) {
                                    q = g
                                }
                            }
                        }
                    }
                    this.SetDay(q)
                } else {
                    if (d == "popupmonth") {
                        Menu_DispatchEvent(4, k)
                    } else {
                        return TimePopup.superclass.KeyDown.call(this, k)
                    }
                }
            }
        }
    }
    return false
};
TimePopup.prototype.OnOK = function() {
    var b = this.mField.ValidatePopupValue(this.mDateVal);
    if (b == null) {
        this.mField.SetFromPopup(this.mDateVal);
        this.HidePopup(true)
    } else {
        new WorkflowContext(this.windowID, {
            f: MessagePopup,
            a: [this.windowID, new Array(b)]
        })
    }
};
TimePopup.prototype.Validate_Hour = function(h, k, f) {
    var g = this.mDateVal.GHour();
    if (f == 38) {
        g = (g + 1) % 24
    } else {
        if (f == 40) {
            g = (--g) < 0 ? g + 24 : g
        } else {
            if ((f >= 48 && f <= 57) || (f >= 96 && f <= 105)) {
                if (this.militaryTime) {
                    var o = (!isNaN(h) && (h == 1 || (h == 2 && k <= 3))) ? ((10 * h) + k) : k;
                    g = parseInt(o)
                } else {
                    var d = (this.mDateVal.GHour() >= 12) ? 12 : 0;
                    var o = (!isNaN(h) && (h == 1 && k <= 2)) ? ((10 * h) + k) : ((isNaN(h) || k > 0) ? k: h);
                    var g = parseInt(o);
                    if (g < 12) {
                        g += d
                    }
                }
            }
        }
    }
    this.mDateVal.SHour(g);
    if (!this.militaryTime && (g == 12 || g == 0 || g == 11 || g == 23)) {
        var b = document.getElementById("meridiem");
        if (b) {
            b.value = ((g == 0 || g == 11) ? localeInfo.AMPM[0] : localeInfo.AMPM[1])
        }
    }
    return this.AdjustHour(this.mDateVal.GHour())
};
TimePopup.prototype.AdjustHour = function(b) {
    if (!this.militaryTime) {
        if (b == 0) {
            b = 12
        } else {
            if (b >= 13) {
                b -= 12
            }
        }
    }
    return b
};
TimePopup.Validate_Min_Sec = function(d, f, b) {
    if (b == 38) {
        return (d == 59) ? 0 : ++d
    } else {
        if (b == 40) {
            return (d == 0) ? 59 : --d
        }
    }
    return ((b >= 48 && b <= 57) || (b >= 96 && b <= 105)) ? ((d <= 5) ? ((10 * d) + f) : f) : d
};
TimePopup.prototype.Validate_Min = function(d, f, b) {
    this.mDateVal.SMinute(TimePopup.Validate_Min_Sec(d, f, b));
    return this.mDateVal.GMinute()
};
TimePopup.prototype.Validate_Sec = function(d, f, b) {
    this.mDateVal.SSecond(TimePopup.Validate_Min_Sec(d, f, b));
    return this.mDateVal.GSecond()
};
TimePopup.prototype.Validate_Meridiem = function(b) {
    if (b == localeInfo.AMPM[0]) {
        b = localeInfo.AMPM[1];
        this.mDateVal.SHour(this.mDateVal.GHour() + 12)
    } else {
        b = localeInfo.AMPM[0];
        this.mDateVal.SHour(this.mDateVal.GHour() - 12)
    }
    return b
};
TimePopup.prototype.Click = function(s) {
    var k = s.element,
    f = k.id;
    if (f && f != "up" && f != "down" && this.mShowTime) {
        var q = this.mDiv.getElementsByTagName("INPUT");
        for (var o = 0; o < q.length; o++) {
            q[o].isSelected = false
        }
    }
    if (f && (f == "up" || f == "down")) {
        var A = (f == "up") ? 38 : 40;
        var k;
        var q = this.mDiv.getElementsByTagName("INPUT");
        for (var o = 0; o < q.length; o++) {
            if (q[o].isSelected) {
                k = q[o];
                break
            }
        }
        if (k) {
            if (! (k.id == "hr" || k.id == "min" || k.id == "sec" || k.id == "meridiem")) {
                var w = this.mDiv.getElementsByTagName("INPUT");
                for (var h = 0; h < w.length; h++) {
                    if (w[h].id == "hr") {
                        k = w[h];
                        k.select();
                        k.isSelected = true;
                        break
                    }
                }
            }
        }
        if (k) {
            f = k.id;
            var y = k.value;
            var d = parseFloat(y);
            var g = y;
            if (f == "meridiem") {
                k.value = this.Validate_Meridiem(y)
            } else {
                k.value = (f == "hr") ? this.Validate_Hour(d, 0, A) : (f == "min") ? ARDate.zeroPad(this.Validate_Min(d, 0, A)) : (f == "sec") ? ARDate.zeroPad(this.Validate_Sec(d, 0, A)) : y
            }
        }
    } else {
        if (f && (f == "hr" || f == "min" || f == "sec" || f == "meridiem" || f == "popupyear")) {
            k.select();
            k.isSelected = true
        } else {
            if (f && f == "bc") {
                var u = this.mDateVal.GYear();
                if (u < 0) {
                    u = Math.abs(u) + 1
                } else {
                    u = -u
                }
                this.mDateVal.SYear(u);
                this.SetYear(Math.abs(this.mDateVal.GYear()));
                return true
            } else {
                if (f && (f == "popupmonth") || (f == "monthmenu")) {
                    var b = document.getElementById("popupmonth");
                    if (!this.mMenu) {
                        this.mMenu = new MonthDropDownMenu(this.windowID, b)
                    }
                    return new WorkflowContext(this.windowID, {
                        f: this.mMenu.Open,
                        t: this.mMenu,
                        a: [b, 3]
                    })
                }
            }
        }
    }
    return false
};
MonthDropDownMenu.prototype = new Menu();
MonthDropDownMenu.prototype.constructor = MonthDropDownMenu;
MonthDropDownMenu.superclass = Menu.prototype;
function MonthDropDownMenu(b, d) {
    if (arguments.length) {
        this.init(b, d)
    }
}
MonthDropDownMenu.prototype.init = function(b, f) {
    var g = [];
    for (var d = 0; d < 12; d++) {
        g.push({
            l: ARDate.MonthLabel(d),
            v: ARDate.MonthLabel(d)
        })
    }
    MonthDropDownMenu.superclass.init.call(this, b, g);
    this.mField = f
};
MonthDropDownMenu.prototype.Open = function(b) {
    return {
        n: {
            f: MonthDropDownMenu.superclass.Open,
            t: this,
            a: [b, 3, nextZIndex++, false]
        }
    }
};
MonthDropDownMenu.prototype.HandleSelection = function(b) {
    this.mField.value = b;
    TimePopup.prototype.SetMonth.call(getOpenDIVPopup_NS(this.windowID), parseInt(localeInfo.monthsLongMap[b.toLowerCase()]))
};
DTrim.prototype = new Field();
DTrim.prototype.constructor = DTrim;
DTrim.superclass = Field.prototype;
TPATrim.prototype = new Field();
TPATrim.prototype.constructor = TPATrim;
TPATrim.superclass = Field.prototype;
DOMFieldFactories.Trim = function(b, f, d) {
    return new DTrim(b, f, d)
};
function DTrim(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DTrim.prototype.mDOMField = DTrim.prototype.mHaveVisualCharacteristics = true;
DTrim.prototype.init = function(g, f, d) {
    DTrim.superclass.init.call(this, g, f, d);
    var h = this.mObj.getElementsByTagName("TD");
    if (h != null) {
        this.mTextElement = h[0]
    }
};
DTrim.prototype.Clear = function() {};
DTrim.prototype.mHaveStoredData = false;
TPAFieldFactories.Trim = function(b, f, d) {
    return new TPATrim(b, f, d)
};
function TPATrim(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DTrim.prototype.UpdateLabel = function(b) {
    if (!this.mTextElement) {
        return
    }
    this.mTextElement.innerHTML = this.ReplaceText(b)
};
DTrim.prototype.UpdateAccess = function(h) {
    var f = (h == 3);
    var k, b;
    if (this.mObj.getAttribute("arsubtype") == 3) {
        k = this.mTextElement;
        b = "disabled"
    } else {
        k = this.mObj;
        if (k.firstChild && k.firstChild.tagName == "B") {
            b = "roundedtrimBorderDisabled"
        } else {
            b = "trimBorderDisabled"
        }
    }
    if (f) {
        var g = k.className.split(" ");
        g.push(b);
        k.className = g.join(" ")
    } else {
        var d = new RegExp(b);
        k.className = k.className.replace(d, "")
    }
};
DTrim.prototype.UpdateFont = function(b) {
    var d = this.mTextElement;
    if (!d) {
        return
    }
    DTrim.superclass.UpdateFont.call(this, b)
};
DTrim.prototype.GetFocusElement = function() {
    if (! ("mFocusElement" in this)) {
        var b = this.mObj.getElementsByTagName("TABLE");
        if (b != null) {
            this.mFocusElement = b[0]
        } else {
            this.mFocusElement = null
        }
    }
    return this.mFocusElement
};
DTrim.prototype.ReplaceText = function(q) {
    var s = new Array();
    var h = new RegExp("<\\s*[aA][^>]*>.*?</[aA]\\s*>", "mig");
    var f = q.match(h);
    var k = q;
    if (f != null) {
        for (var g = 0; g < f.length; g++) {
            var o = f[g];
            var d = k.indexOf(o);
            if (d > 0) {
                s.push(MassageText(k.substring(0, d)))
            }
            var p = o.indexOf(">");
            if (p != -1) {
                var b = o.substring(p + 1);
                o = o.substring(0, p) + " class=TrimLink>" + b
            }
            s.push(o);
            k = k.substring(d + f[g].length)
        }
    }
    if (k.length > 0) {
        s.push(MassageText(k))
    }
    return s.join("")
};
function MassageText(d) {
    var b = 0;
    d = d.replace(/\n/gim, "<br>");
    d = d.replace(/(<BR>)|(&nbsp)|(<)|(>)|(\")|(\s)/gim,
    function(g, q, p, o, k, h, f) {
        if (q) {
            return q
        }
        if (p) {
            return p
        }
        if (o) {
            return "&lt;"
        }
        if (k) {
            return "&gt;"
        }
        if (h) {
            return "&quot;"
        }
        if (f) {
            return "&nbsp;"
        }
    });
    return d
}
DTrim.prototype.ResizeTo = function(f, b) {
    var d = this.mObj.getAttribute("arsubtype");
    if (d == 1) {
        if (this.mObj.style.width == "2px") {
            this.mObj.style.height = this.perHeight + "%"
        } else {
            if (this.mObj.style.height == "2px") {
                this.mObj.style.width = this.perWidth + "%"
            }
        }
    } else {
        if (d == 2 || d == 3) {
            DTrim.superclass.ResizeTo.call(this, f, b)
        }
    }
};
TPATrim.prototype.DOMClick = TPATrim.prototype.DOMKeyPress = function(b) {};
DocView.prototype.constructor = DocView;
DocView.URLPAT = new RegExp("^((https?)|(ftps?)|(file)):[\\\\/][\\\\/].*", "i");
DocView.HTMLDOCPAT = new RegExp("((<html)|(<body))", "i");
DocView.FRAMEBORDERRE = new RegExp("frameborder=([^\\s]+)", "i");
DocView.SCROLLRE = new RegExp("scrolling=([^\\s]+)", "i");
DocView.mFrameID = 0;
DocView.parseFrameBorder = /[0-9]/g;
function DocView(d, b, k, g, h, f) {
    if (arguments.length) {
        this.init(d, b, k, g, h, f)
    }
}
DocView.prototype.init = function(d, k, h, q, g, f) {
    this.mUpdateTimeout = null;
    this.mObj = d;
    this.mFrameHTML = h;
    this.mFrameName = k;
    this.mAutosize = q;
    this.mHandler = null;
    this.mHandlerObj = null;
    this.mFrameborder = 0;
    this.mScroll = "auto";
    this.mValue = "";
    if (this.mAutosize == null || typeof this.mAutosize == "undefined") {
        this.mAutosize = false
    }
    if (g != null && typeof g != "undefined") {
        this.mHandler = g;
        this.mHandlerObj = (f != null) ? f: this
    }
    if (h == null || h.length === 0) {
        DocView.mFrameID++;
        this.mFrameName = "DOCFRM" + DocView.mFrameID;
        var b = "background-color:transparent;position:static;";
        if (this.mAutosize == false) {
            b += "width:100%;height:100%;"
        }
        this.mFrameHTML = " <iframe name=" + this.mFrameName + ' style="' + b + '" frameborder=0 scrolling="auto" allowtransparency="true" src="javascript:\'<HTML></HTML>\'"></iframe>'
    }
    var p = DocView.FRAMEBORDERRE.exec(this.mFrameHTML);
    if (p != null) {
        this.mFrameborder = parseInt(p[1].replace(/\"/g, ""))
    }
    var o = DocView.SCROLLRE.exec(this.mFrameHTML);
    if (o != null) {
        this.mScroll = o[1].match("[A-Za-z]+")
    }
};
DocView.GetIFrameDoc = function(b, d) {
    try {
        return ("contentDocument" in b) ? b.contentDocument: window.frames[d].document
    } catch(f) {
        return null
    }
};
DocView.prototype.GetInnerDocument = function() {
    var d = this.mObj.childNodes[1];
    try {
        return ("contentDocument" in d) ? d.contentDocument: window.frames[this.mFrameName].document
    } catch(b) {
        return null
    }
};
DocView.prototype.hasHTMLDOCPAT = function() {
    if (this.mObj && this.mObj.innerHTML) {
        return this.mObj.innerHTML.match(DocView.HTMLDOCPAT)
    } else {
        return false
    }
};
DocView.prototype.G = function() {
    return this.mValue
};
DocView.prototype.S = function(g, f) {
    this.mValue = g;
    if (this.mUpdateTimeout != null) {
        window.clearTimeout(this.mUpdateTimeout);
        this.mUpdateTimeout = null
    }
    var h;
    if (this.vfchild) {
        h = this.vfchild
    } else {
        h = this.mObj.childNodes[1]
    }
    if (g.match(DocView.URLPAT)) {
        if (h == null || h.tagName != "IFRAME") {
            this.mObj.style.border = "";
            this.mObj.style.overflow = "hidden";
            this.mObj.innerHTML = this.mFrameHTML
        } else {}
        try {
            this.mObj.childNodes[1].src = g;
            if (this.mHandler) {
                this.mHandler.call(this.mHandlerObj)
            }
        } catch(d) {}
    } else {
        if (g.match(DocView.HTMLDOCPAT)) {
            if (h == null || h.tagName != "IFRAME") {
                this.mObj.style.border = "";
                this.mObj.style.overflow = "hidden"
            }
            this.mObj.innerHTML = this.mFrameHTML;
            var b = this;
            this.mUpdateTimeout = window.setTimeout(function() {
                b.mUpdateTimeout = null;
                var k = b.GetInnerDocument();
                if (k != null) {
                    k.open();
                    k.write(g);
                    k.close();
                    if (b.mAutosize) {
                        b.mObj.childNodes[1].style.width = k.body.scrollWidth;
                        b.mObj.childNodes[1].style.height = k.body.scrollHeight
                    }
                    if (f) {
                        k.documentElement.dir = "rtl"
                    }
                    if (b.mHandler) {
                        b.mHandler.call(b.mHandlerObj)
                    }
                }
            },
            50)
        } else {
            this.mObj.style.border = (this.mFrameborder == 0) ? "": "solid 1px black";
            this.mObj.style.overflow = (this.mScroll == "auto") ? "auto": ((this.mScroll == "yes") ? "scroll": "hidden");
            if (this.mObj.id == "artooltip") {
                g = "<div style='padding:5px;'>" + g + "</div>"
            }
            this.mObj.innerHTML = g;
            if (this.mHandler) {
                this.mHandler.call(this.mHandlerObj)
            }
        }
    }
};
DView.prototype = new AsyncField();
DView.prototype.constructor = DView;
DView.superclass = AsyncField.prototype;
JView.prototype = new Field();
JView.prototype.constructor = JView;
JView.superclass = Field.prototype;
TPAView.prototype = new Field();
TPAView.prototype.constructor = TPAView;
TPAView.superclass = Field.prototype;
DOMFieldFactories.View = function(b, f, d) {
    return new DView(b, f, d)
};
function DView(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DView.prototype.val = Null;
DView.prototype.mDOMField = DView.prototype.mHaveVisualCharacteristics = true;
DView.GlobalFuncRE = /DVFol/g;
DView.prototype.init = function(b, f, d) {
    DView.superclass.init.call(this, b, f, d);
    this.mode = this.mObj.getAttribute("mode");
    this.mForm = false;
    this.mChildWindowID = null;
    this.mFormServer = null;
    this.mFormName = null;
    this.mViewName = null;
    this.mFormOpeningArgs = null;
    this.mFormLoaded = false;
    this.inlineFormDisplayed = false;
    this.clearInlineFormFlag = false;
    this.mFloatingPanels = [];
    this.mFrameName = "VF" + this.mID + "_" + new Date().getTime() + "IF_" + b;
    if (!this.mode) {
        this.mode = 0
    }
    if (this.mode == 0) {
        this.mFrameHTML = " " + this.mObj.getAttribute("arvfframe");
        this.mFrameHTML = this.mFrameHTML.replace(DView.GlobalFuncRE, "F(" + b + "," + f + ").ol");
        if (this.mContainerID != null) {
            this.mFrameHTML = this.mFrameHTML.replace(/(WIDTH:[^;]*;)|(width:[^;]*;)/g, "width:100%;");
            this.mFrameHTML = this.mFrameHTML.replace(/(HEIGHT:[^;]*;)|(height:[^;]*;)/g, "height:100%;")
        }
        this.mFrameHTML = this.mFrameHTML.replace(/(name=[^\s\>]+)|((name=\"[^\"]+\"))/g, 'name="' + this.mFrameName + '"');
        this.mTemplateName = null;
        this.DataDefault();
        this.mViewObj = new DocView(this.mObj, this.mFrameName, this.mFrameHTML);
        getViewFields_NS(b)[this.mID] = this
    }
    this.ft = true
};
DView.prototype.setClearInlineFormFlag = function(b) {
    this.clearInlineFormFlag = b
};
DView.prototype.getClearInlineFormFlag = function() {
    return (this.clearInlineFormFlag)
};
DView.prototype.GetInnerDocument = function() {
    return this.mViewObj.GetInnerDocument()
};
DView.prototype.mHaveStoredData = false;
DView.TEMPLATEPAT = new RegExp("^template:", "i");
DView.TEMPLATENAMERE = new RegExp("^template:(.*)", "i");
DView.prototype.Clear = function() {
    var b = this.mID;
    this.ClearInlineFormSettings();
    if ((b >= 1000000 && b <= 1999999) || (b >= 3000000 && b <= 3999999) || b == 1576 || b == 1575) {
        return
    }
    if (this.mTemplateName != null) {
        return this.S(new CharType("template:" + this.mTemplateName))
    }
    return this.S(Null)
};
DView.prototype.GDefault = function() {
    if (this.mID != 1575) {
        this.val = Null
    }
    var b = getDefaults_NS(this.windowID);
    if ("d" in b[this.mID]) {
        return (new CharType(ExpandString(this.windowID, "" + b[this.mID].d, 2)))
    }
    return Null
};
DView.prototype.DoSet = DView.prototype.DoSLoadEntry = function(f) {
    if (f.isNull) {
        this.val = Null
    } else {
        if (f instanceof CharType) {
            this.val = f
        } else {
            if (f instanceof AttachmentType) {
                this.val = new CharType(encodeURI(f.toURL()))
            } else {
                this.val = new CharType(f)
            }
        }
    }
    if (this.mTemplateName != null) {
        getTemplateFields_NS(this.windowID)[this.mID] = null
    }
    this.mTemplateName = null;
    if (this.val.toString().match(DView.TEMPLATEPAT)) {
        var b = this.val.toString();
        var d = DView.TEMPLATENAMERE.exec(b);
        if (d != null) {
            this.mTemplateName = d[1];
            getTemplateFields_NS(this.windowID)[this.mID] = this
        }
    }
    if (!this.mModified) {
        this.mModified = true
    }
};
DView.Refresh = function(d, b) {
    var f = F(d, b);
    if (f == null) {
        return
    }
    f.disableSetFieldsEvent();
    if (f.mModified == false) {
        f.setContents()
    }
};
DView.prototype.FlushAsyncQueue = function() {
    if (this.mModified == true) {
        this.setContents()
    }
};
DView.prototype.setContents = function() {
    if (this.mode == 0) {
        if (this.mTemplateName != null) {
            var d = T(this.windowID, this.mTemplateName);
            if (d != null) {
                d.setDefaultParamValues();
                this.val = new CharType(d.process(this.windowID))
            }
        }
        var f = this.val.toString();
        if (f == null || f == "" || this.inlineFormDisplayed == false) {
            this.ClearInlineFormSettings()
        }
        this.mModified = false;
        if (this.isSetFieldsEventEnabled()) {
            this.setFieldsAsEvent(f)
        } else {
            var b = false;
            this.mViewObj.S(f, b)
        }
        this.mObj.setAttribute("arstop", "0");
        if (this.isInlineForm()) {
            this.inlineFormDisplayed = false;
            this.ClearInlineForm();
            this.mObj.setAttribute("arstop", "1");
            var g = this;
            setTimeout(function() {
                buildNewInlineForm(g.mChildWindowID, g.windowID, g.mFormServer, g.mFormName, g.mViewName, g.mObj, g.mFormOpeningArgs, "VF" + g.mID + "_" + new Date().getTime() + "IN");
                g.mFormLoaded = true
            },
            10)
        }
    } else {
        if (this.mode == 1) {
            this.getList();
            this.mModified = false
        }
    }
};
DView.prototype.isSetFieldsEventEnabled = function() {
    return false
};
DView.prototype.setFieldsAsEvent = function(b) {};
DView.prototype.disableSetFieldsEvent = function() {};
DView.prototype.TabableElementSelector = function(d) {
    if (d.tagName == "IFRAME") {
        try {
            var b = this.GetInnerDocument();
            if (b != null) {
                return (b.body == null) ? b: ((b.body.childNodes[1] == null) ? b.body: b.body.childNodes[1])
            }
            return d
        } catch(f) {}
    } else {
        if (d.tagName == "DIV") {
            return d
        }
    }
    return null
};
DView.prototype.DOMKeyPress = function(d) {
    if (d.key == 13) {
        var b = this.GetInnerDocument();
        if (b != null && "focus" in b) {
            setTimeout(function() {
                b.focus()
            },
            0)
        }
        return
    }
};
DView.prototype.ol = function() {
    var b = this;
    setTimeout(function() {
        var f = b.GetInnerDocument();
        try {
            if (f && f.body && !(f.body.style.backgroundColor)) {
                var h = (document.defaultView.getComputedStyle(f.body, null).getPropertyValue("background-color"));
                if (h == "#ffffff" || h == "transparent") {
                    f.body.style.backgroundColor = "transparent"
                }
            }
            if (f) {
                var g = b.GetParent();
                if (g && (g.mParentObj.mViewTypeObj.mStackViewType == "fixed") && ("getPaneAttributes" in g)) {
                    g.getPaneAttributes();
                    if (g.mFit) {
                        this.applyLayout();
                        setTimeout(function() {
                            var k = traverseFields(b, g.mParentObj.mViewTypeObj.mOrientation);
                            if (k > 0) {
                                g.setDirty(k)
                            }
                        },
                        0)
                    }
                }
            }
        } catch(d) {}
    },
    0)
};
DView.prototype.applyLayout = function() {
    var b = window.frames[this.mFrameName];
    if (b != null) {
        if (typeof b.FormPane.Layout == "function") {
            b.FormPane.Layout()
        }
    }
};
DView.prototype.G = function() {
    return this.val
};
DView.prototype.GetFocusElement = function() {
    var b = this.mObj.childNodes[1];
    return (b != null) ? b: this.mObj
};
DView.prototype.UpdateVis = function(d) {
    var b = (this.mObj.style.visibility != "hidden");
    if (!b && d) {
        this.SetAsync( - 1);
        this.mObj.style.visibility = "inherit"
    } else {
        if (b && !d) {
            this.SetAsync(1);
            this.mObj.style.visibility = "hidden"
        }
    }
};
DView.prototype.ResizeTo = function(f, b) {
    var d = Math.round(b * (this.perHeight / 100));
    var g = f;
    if (g < this.mMinWidth) {
        g = this.mMinWidth
    } else {
        if (g > this.mMaxWidth) {
            g = this.mMaxWidth
        }
    }
    if (d < this.mMinHeight) {
        d = this.mMinHeight
    } else {
        if (d > this.mMaxHeight) {
            d = this.mMaxHeight
        }
    }
    this.mObj.style.width = g;
    this.mObj.style.height = d;
    var h = this.GetFocusElement();
    if (h && h.tagName == "IFRAME") {
        h.style.width = g;
        h.style.height = d
    }
    if (this.mFormLoaded && this.mForm && this.mChildWindowID != null) {
        FormPane.Layout(this.mChildWindowID)
    }
};
DView.SendSignalToParent = function(b, g, d, f) {
    if (arguments.length == 3) {
        f = d;
        d = g;
        g = b;
        b = getCurrentWindowID_NS();
        ARProcessEvent.DeliverEvent(b, "#", d + "", f + "")
    }
    ARProcessEvent.Add(b, d + "", f + "", g + "", true)
};
DView.prototype.HandleEvent = function(d, g) {
    try {
        if (this.mForm && this.mChildWindowID != null) {
            ARProcessEvent.Add(this.mChildWindowID, d + "", g + "", "@")
        } else {
            var b = window.frames[this.mFrameName];
            if (b != null) {
                if ("EventDispatcher" in b && typeof b.EventDispatcher.dispatch == "function") {
                    b.EventDispatcher.dispatch(d, g)
                } else {
                    if ("ARProcessEvent" in b && typeof b.ARProcessEvent.Add == "function") {
                        b.ARProcessEvent.Add(b.getTopWinWindowID_NS(), d + "", g + "", "@")
                    }
                }
            }
        }
    } catch(f) {}
};
DView.tabForward = function() {
    setTimeout(function() {
        arJumpOutForward()
    },
    100)
};
DView.tabBackward = function() {
    setTimeout(function() {
        arJumpOutBackward()
    },
    100)
};
function addAsScript(g) {
    try {
        var f = document.getElementsByTagName("head")[0];
        var b = document.createElement("SCRIPT");
        b.type = "text/javascript";
        b.appendChild(document.createTextNode(g));
        f.appendChild(b)
    } catch(d) {}
}
function InjectFormJS(g, f, b, h, d) {
    createScriptTag(RelContextPath + "forms/" + g + "/" + f + "/" + b + "/form.js/" + h + ".js?format=html");
    createScriptTag(RelContextPath + "forms/" + g + "/" + f + "/" + b + "/udd.js?format=html&w=" + encodeURIComponent(d))
}
function replaceDOMID(d, b) {
    return d.replace(/((\<div.*\sid=)([0-9]+))|((\<a.*\sid=)(([0-9]+)))/gm,
    function(g, q, p, o, k, h, f) {
        if (q) {
            return p + '"' + b + o + '"'
        }
        if (k) {
            return h + '"' + b + f + '"'
        }
    })
}
DView.prototype.OpenInlineForm = function(h, f, q, u, o, d, b) {
    this.mForm = true;
    if (this.mChildWindowID == null) {
        this.mChildWindowID = allocWindowID_NS()
    }
    this.mFormServer = h;
    this.mFormName = f;
    this.mViewName = q;
    this.mFormOpeningArgs = o;
    this.inlineFormDisplayed = true;
    var k = h + "_" + f + "_" + q;
    var s = ("uddjs_" + k + "_loaded").ARToJSIdentifier();
    var g = ("formjs_" + k + "_loaded").ARToJSIdentifier();
    if (d && (typeof window[s] == "undefined" || typeof window[g] == "undefined")) {
        if (u.js) {
            addAsScript(u.js);
            addAsScript(u.udd)
        } else {
            InjectFormJS(h, f, q, u.cacheid, o.wname)
        }
    }
    wm.incInlineFormLoadCounter();
    this.S(new CharType(u.body.replace(/WIN_0_/gm, "WIN_" + this.mChildWindowID + "_")));
    var p = this.windowID;
    if (b == true) {
        setTimeout(function() {
            new WorkflowContext(p, [])
        },
        0)
    }
};
DView.prototype.ClearFloatingPanels = function() {
    while (this.mFloatingPanels.length > 0) {
        var b = this.mFloatingPanels.pop();
        b.innerHTML = "";
        document.body.removeChild(b)
    }
    this.mFloatingPanels = []
};
DView.prototype.ClearInlineFormSettings = function() {
    if (this.isInlineForm()) {
        if (this.clearInlineFormFlag) {
            this.mObj.innerHTML = "";
            this.clearInlineFormFlag = false
        }
        this.ClearInlineForm();
        this.mForm = false;
        this.mFormServer = null;
        this.mFormName = null;
        this.mViewName = null;
        this.mFormOpeningArgs = null;
        this.mFormLoaded = false;
        this.inlineFormDisplayed = false
    }
};
DView.prototype.ClearInlineForm = function() {
    if (isLogicalWindow(this.mChildWindowID)) {
        LogicalWindowOnUnload(this.mChildWindowID);
        wm.unregisterWindow(this.mChildWindowID);
        if (FocusMgr.mCurFocusWindowID == this.mChildWindowID) {
            FocusMgr.mFocusStk = [];
            FocusMgr.mCurFocusID = 0;
            FocusMgr.mCurFocusWindowID = this.windowID
        }
        this.ClearFloatingPanels()
    }
};
DView.prototype.isInlineForm = function() {
    return (this.mForm && this.mChildWindowID != null)
};
DView.prototype.GetDOMName = function() {
    return this.mFrameName
};
JFieldFactories.View = function(b, f, d) {
    return new JView(b, f, d)
};
function JView(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
JView.prototype.G = function() {
    return this.mObj.v
};
JView.prototype.DoSet = function(b) {
    this.mObj.v = b
};
TPAFieldFactories.View = function(b, f, d) {
    return new TPAView(b, f, d)
};
function TPAView(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAView.prototype.DoSet = TPAView.prototype.DoSLoadEntry = function(b) {
    if (b.isNull) {
        this.val = Null
    } else {
        if (b instanceof CharType) {
            this.val = b
        } else {
            if (b instanceof AttachmentType) {
                this.val = new CharType(encodeURI(b.toURL()))
            } else {
                this.val = new CharType(b)
            }
        }
    }
    this.mTemplateName = null;
    if (!this.mModified) {
        this.mModified = true
    }
};
SelectionMenu.prototype = new Menu();
SelectionMenu.prototype.constructor = SelectionMenu;
SelectionMenu.superclass = Menu.prototype;
function SelectionMenu(d, b) {
    if (arguments.length) {
        this.init(d, b)
    }
}
SelectionMenu.prototype.init = function(d, b) {
    SelectionMenu.superclass.init.call(this, d.windowID, b);
    this.mField = d
};
SelectionMenu.prototype.Open = function(b) {
    return {
        n: {
            f: SelectionMenu.superclass.Open,
            t: this,
            a: [b, 3, 30100, false]
        }
    }
};
SelectionMenu.prototype.HandleSelection = function(b) {
    this.mField.HandleMenuSelection(b);
    promptBar.setToClear();
    new WorkflowContext(this.windowID, {
        f: ExecuteWorkflow,
        a: [this.windowID, 2, this.mField.mID]
    })
};
DEnumSel.prototype = new DataField();
DEnumSel.prototype.constructor = DEnumSel;
DEnumSel.superclass = DataField.prototype;
TPAEnumSel.prototype = new Field();
TPAEnumSel.prototype.constructor = TPAEnumSel;
TPAEnumSel.superclass = Field.prototype;
DOMFieldFactories.EnumSel = function(b, f, d) {
    return new DEnumSel(b, f, d)
};
function DEnumSel(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DEnumSel.prototype.init = function(windowID, id, n) {
    var np = n.childNodes[2];
    this.mInputNode = np.childNodes[1];
    var menuStruct = np.getAttribute("arselmenu");
    var inMenudef = eval(menuStruct);
    var menudef = [];
    var iOrder = [];
    var mIndex = 0;
    for (var i = 0; i < inMenudef.length; ++i) {
        if (! ("ci" in inMenudef[i])) {
            mIndex = i
        } else {
            mIndex = inMenudef[i].ci
        }
        menudef[mIndex] = {};
        menudef[mIndex].ord = i;
        menudef[mIndex].v = inMenudef[i].v.ValidatorUnEscape();
        if (! ("l" in inMenudef[i])) {
            menudef[mIndex].l = inMenudef[i].v.ValidatorUnEscape()
        } else {
            menudef[mIndex].l = inMenudef[i].l.ValidatorUnEscape()
        }
        iOrder[i] = mIndex
    }
    this.mMenuDef = menudef;
    this.mOrder = iOrder;
    DEnumSel.superclass.init.call(this, windowID, id, n)
};
TPAFieldFactories.EnumSel = function(b, f, d) {
    return new TPAEnumSel(b, f, d)
};
function TPAEnumSel(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DEnumSel.getClearValue = function() {
    var b = getLocalizedMessage("(clear)");
    return {
        l: b,
        v: ""
    }
};
DEnumSel.prototype.GetFocusElement = function() {
    return this.mInputNode
};
TPAEnumSel.prototype.ConvertPrimitiveToDataType = DEnumSel.prototype.ConvertPrimitiveToDataType = function(g) {
    var f = this.mMenuDef;
    if (g != "") {
        g = g.HTMLEncode();
        for (var b in f) {
            if (f[b].l == g) {
                return new EnumType(b, ExpandString(this.windowID, f[b].l, 2 | 4))
            }
        }
        if (!isNaN(g)) {
            var d = f[g];
            if (d != null) {
                return new EnumType(g, ExpandString(this.windowID, d.l, 2 | 4))
            }
        }
    }
    return Null
};
TPAEnumSel.prototype.ConvertDTForSLE = DEnumSel.prototype.ConvertDTForSLE = function(g) {
    var f = this.mMenuDef;
    if (g.type == 6) {
        var d = g.toInteger();
        var b = f[d];
        if (b != null) {
            return new EnumType(d, ExpandString(this.windowID, b.l.HTMLDecode(), 2 | 4))
        }
    }
    return Null
};
TPAEnumSel.prototype.ConvertDTForS = DEnumSel.prototype.ConvertDTForS = function(k) {
    if (!this.mMenuDef && this instanceof TPAEnumSel) {
        this.buildEnumSelMenu()
    }
    var h = this.mMenuDef;
    var b = k.toString().HTMLEncode();
    switch (k.type) {
    case 6:
        var g = k.toInteger();
        var f = h[g];
        if (f != null) {
            return new EnumType(g, ExpandString(this.windowID, f.l.HTMLDecode(), 2 | 4))
        } else {
            return Null
        }
        break;
    default:
        if (k.type == 4 || k.type == 5) {
            if (b == "") {
                return Null
            }
            for (var d in h) {
                if (h[d].l == b) {
                    return new EnumType(d, ExpandString(this.windowID, h[d].l, 2 | 4))
                }
            }
        }
        var g = k.toInteger();
        var f = h[g];
        if (f != null) {
            return new EnumType(g, ExpandString(this.windowID, f.l.HTMLDecode(), 2 | 4))
        } else {
            return Null
        }
    }
};
TPAEnumSel.prototype.GP = DEnumSel.prototype.GP = function() {
    var b = this.G();
    if (b.isNull) {
        return Null
    }
    var d = b.mValue;
    return this.GetValueForPush(d)
};
DEnumSel.prototype.GetValueForPush = function(d) {
    var f = this.mMenuDef;
    var b = f[d];
    if (b != null) {
        return new EnumType(d, ExpandString(this.windowID, b.v.HTMLDecode(), 2 | 4))
    } else {
        return Null
    }
};
TPAEnumSel.prototype.GetValueForPush = function(b) {
    if ((typeof this.mObj != "undefined") && (typeof this.mObj.e != "undefined") && this.mObj.e[b] != null) {
        return new EnumType(b, ExpandString(this.windowID, this.mObj.e[b].HTMLDecode(), 2 | 4))
    } else {
        return Null
    }
};
TPAEnumSel.prototype.FieldValChanged = function(b, d) {
    if (d) {
        this.mDataVal = this.ConvertPrimitiveToDataType(d)
    } else {
        this.mDataVal = Null
    }
    this.DoSet(this.mDataVal)
};
TPAEnumSel.prototype.FindContainingDiv = function(b) {
    while (b.nodeType != 1 || (b.tagName != "DIV")) {
        b = b.parentNode
    }
    return b
};
DEnumSel.prototype.GetFirst = function() {
    var b = this.mOrder;
    return b[0]
};
DEnumSel.prototype.GetLast = function() {
    var b = this.mOrder;
    return b[b.length - 1]
};
DEnumSel.prototype.GetNext = function(g) {
    var b = this.mOrder;
    var f = this.mMenuDef;
    var d = f[g].ord;
    if (d != null) {
        d++;
        if (d >= b.length) {
            return - 1
        } else {
            return b[d]
        }
    }
    return - 1
};
DEnumSel.prototype.GetPrev = function(g) {
    var b = this.mOrder;
    var f = this.mMenuDef;
    var d = f[g].ord;
    if (d != null) {
        d--;
        if (d < 0) {
            return - 1
        } else {
            return b[d]
        }
    }
    return - 1
};
TPAEnumSel.prototype.DoSet = TPAEnumSel.prototype.DoSLoadEntry = function(b) {
    if (b.isNull) {
        this.mObj.v = Null
    } else {
        if (ARKWIsKeywordString(this.windowID, b)) {
            this.mObj.v = new CharType(b.toString())
        } else {
            this.mObj.v = this.ConvertDTForS(b)
        }
    }
};
DEnumSel.prototype.UpdateAccess = function(b) {
    DEnumSel.superclass.UpdateAccess.call(this, b);
    this.mInputNode.readOnly = 1
};
DEnumSel.prototype.mHaveStoredData = true;
DEnumSel.prototype.mDataType = 6;
TPAEnumSel.prototype.G = function() {
    var g = this.mObj.v;
    if (g.isNull) {
        return g
    } else {
        var b = g.toString();
        var f = F(this.windowID, this.cmid);
        for (var d in f.mObj.e) {
            if (f.mObj.e[d].l == b) {
                this.mObj.v = new EnumType(d, b);
                return this.mObj.v
            }
        }
        if (g.type == 6 || b.isDigits()) {
            if (g.type == 4 || g.type == 5) {
                if (!b.isNumeric()) {
                    return Null
                }
            }
            b = g.toInteger();
            for (var d in f.mObj.e) {
                if (d == b) {
                    this.mObj.v = new EnumType(b, f.mObj.e[b].l);
                    return this.mObj.v
                }
            }
        }
        this.mObj.v = Null;
        return Null
    }
};
DEnum.prototype = new DataField();
DEnum.prototype.constructor = DEnum;
DEnum.superclass = DataField.prototype;
JEnum.prototype = new Field();
JEnum.prototype.constructor = JEnum;
JEnum.superclass = Field.prototype;
TPAEnum.prototype = new Field();
TPAEnum.prototype.constructor = TPAEnum;
TPAEnum.superclass = Field.prototype;
DOMFieldFactories.Enum = function(b, f, d) {
    return new DEnum(b, f, d)
};
function DEnum(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DEnum.prototype.clear = function() {
    if (this.mSelected != null) {
        this.mSelected.checked = false;
        this.mSelected = null;
        this.mSelectedIdx = null
    }
};
DEnum.prototype.GetScreenValAsPrimitive = function() {
    if (this.mSelectedIdx != null) {
        return this.mSelectedIdx
    }
    return ""
};
DEnum.prototype.GetScreenValue = function() {
    if (this.mSelectedIdx == null) {
        return ""
    }
    return this.mNumToAlias[this.mSelectedIdx]
};
DEnum.prototype.ConvertPrimitiveToDataType = function(b) {
    if (this.mSelectedIdx != null) {
        return new EnumType(this.mSelectedIdx, ExpandString(this.windowID, this.mNumToAlias[this.mSelectedIdx], 2 | 4))
    }
    return Null
};
DEnum.prototype.ConvertDTForSLE = function(d) {
    var b = d.toInteger();
    if (b in this.mNumToAlias) {
        return new EnumType(b, ExpandString(this.windowID, this.mNumToAlias[b], 2 | 4))
    } else {
        return Null
    }
};
DEnum.prototype.ConvertDTForS = function(f) {
    var d = f.toString();
    switch (f.type) {
    case 6:
        d = f.toInteger();
        if (d in this.mNumToAlias) {
            return new EnumType(d, ExpandString(this.windowID, this.mNumToAlias[d], 2 | 4))
        }
        break;
    default:
        if (f.type == 4 || f.type == 5) {
            var g = this.mAliasToNode[d];
            if (g) {
                var b = g.value;
                return new EnumType(b, ExpandString(this.windowID, this.mNumToAlias[b], 2 | 4))
            }
        }
        d = f.toInteger();
        if (d in this.mNumToAlias) {
            return new EnumType(d, ExpandString(this.windowID, this.mNumToAlias[d], 2 | 4))
        }
    }
    return Null
};
DEnum.prototype.GP = TPAEnum.prototype.GP = JEnum.prototype.GP = function() {
    var b = this.G();
    if (b.isNull) {
        return Null
    }
    var d = b.mValue;
    return this.GetValueForPush(d)
};
DEnum.prototype.GetValueForPush = function(d) {
    var b = this.mNumToAlias[d];
    if (!b) {
        return Null
    }
    var f = this.mAliasToNode[b];
    if (!f) {
        return Null
    }
    var g = f.getAttribute("arvalue");
    if (!g) {
        g = b
    }
    return new EnumType(d, ExpandString(this.windowID, g.HTMLDecode(), 2 | 4))
};
TPAEnum.prototype.GetValueForPush = JEnum.prototype.GetValueForPush = function(d) {
    if ("vl" in this.mObj) {
        var b = this.mObj.vl[d];
        return new EnumType(d, ExpandString(this.windowID, b, 2 | 4))
    }
    return Null
};
TPAEnum.prototype.FieldValChanged = function(b, d) {
    if (d) {
        this.mDataVal = new EnumType(d, ExpandString(this.windowID, this.mNumToAlias[d], 2 | 4))
    } else {
        this.mDataVal = Null
    }
    this.DoSet(this.mDataVal)
};
DEnum.prototype.SToScreen = function(g, f) {
    var b = this.mSelected;
    this.clear();
    if (g.isNull) {
        this.SetDirty(b)
    } else {
        var d = this.mNumToAlias[g.mValue];
        var h = this.mAliasToNode[d];
        h.checked = true;
        this.mSelected = h;
        this.mSelectedIdx = h.value;
        this.SetDirty(h)
    }
    if (typeof AnimMgr != "undefined") {
        AnimMgr.Highlight(this, this.mObj)
    }
};
TPAEnum.prototype.GetElementForARType = function(f) {
    var d = document.body;
    while (f && f != d) {
        var b = f.getAttribute("artype");
        if (b) {
            return f
        }
        f = f.parentNode
    }
    return null
};
TPAEnum.prototype.DOMClick = function(b, d) {
    if (this.GAccess() != 2) {
        return
    }
    var h = b.element;
    var g = this.mSelected;
    this.initVariable(h);
    this.mSelected = null;
    this.mSelectedIdx = null;
    if (h.tagName == "LABEL") {
        h = h.previousSibling
    }
    var k;
    if ((h.tagName == "INPUT") && (g == h)) {
        g.checked = false;
        k = Null
    } else {
        h.checked = true;
        for (var f in this.mAliasToNode) {
            var o = this.mAliasToNode[f];
            if (o.checked && this.mSelected == null) {
                this.mSelected = o;
                this.mSelectedIdx = o.value;
                k = new EnumType(this.mSelectedIdx, ExpandString(this.windowID, this.mNumToAlias[this.mSelectedIdx], 2 | 4))
            } else {
                o.checked = false
            }
        }
    }
    this.DoSet(k);
    if ((d in getFields_NS(this.windowID)) && (getFields_NS(this.windowID)[d].mObj.pnt in getFields_NS(this.windowID))) {
        getFields_NS(this.windowID)[getFields_NS(this.windowID)[d].mObj.pnt].HandleEnumValChanged(b, this.mSelectedIdx)
    }
};
DEnum.prototype.MouseSelectable = false;
DEnum.prototype.mDataType = 6;
DEnum.prototype.mNeedSpecialSetToScreen = true;
JFieldFactories.Enum = function(b, f, d) {
    return new JEnum(b, f, d)
};
function JEnum(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAFieldFactories.Enum = function(b, f, d) {
    return new TPAEnum(b, f, d)
};
function TPAEnum(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
TPAEnum.prototype.G = JEnum.prototype.G = function() {
    var f = this.mObj.v;
    if (f.isNull) {
        return f
    } else {
        var b = f.toString();
        for (var d in this.mObj.e) {
            if (this.mObj.e[d] == b) {
                this.mObj.v = new EnumType(d, b);
                return this.mObj.v
            }
        }
        if (f.type == 6 || b.isDigits()) {
            if (f.type == 4 || f.type == 5) {
                if (!b.isNumeric()) {
                    return Null
                }
            }
            b = f.toInteger();
            for (var d in this.mObj.e) {
                if (d == b) {
                    this.mObj.v = new EnumType(b, this.mObj.e[b]);
                    return this.mObj.v
                }
            }
        }
        this.mObj.v = Null;
        return Null
    }
};
TPAEnum.prototype.ConvertDTForS = JEnum.prototype.ConvertDTForS = function(f) {
    var b = f.toString();
    switch (f.type) {
    case 6:
        b = f.toInteger();
        for (var d in this.mObj.e) {
            if (d == b) {
                return new EnumType(b, this.mObj.e[b])
            }
        }
        break;
    default:
        if (f.type == 4 || f.type == 5) {
            for (var d in this.mObj.e) {
                if (this.mObj.e[d] == b) {
                    return new EnumType(d, b)
                }
            }
        }
        b = f.toInteger();
        for (var d in this.mObj.e) {
            if (d == b) {
                return new EnumType(b, this.mObj.e[b])
            }
        }
    }
    return Null
};
TPAEnum.prototype.DoSet = TPAEnum.prototype.DoSLoadEntry = JEnum.prototype.DoSet = JEnum.prototype.DoSLoadEntry = function(b) {
    if (b.isNull) {
        this.mObj.v = Null
    } else {
        if (ARKWIsKeywordString(this.windowID, b)) {
            this.mObj.v = new CharType(b.toString())
        } else {
            this.mObj.v = this.ConvertDTForS(b)
        }
    }
    if (this instanceof JEnum) {
        this.SetDirty()
    }
};
DEnum.prototype.mHaveStoredData = TPAEnum.prototype.mHaveStoredData = JEnum.prototype.mHaveStoredData = true;
TPAEnum.prototype.GetEnumValues = JEnum.prototype.GetEnumValues = function() {
    return this.mObj.e
};
TPAEnum.prototype.GetSorter = JEnum.prototype.GetSorter = function() {
    return "(ls=parseInt(lhs),rs=parseInt(rhs),(isNaN(ls)?0:ls)-(isNaN(rs)?0:rs))"
};
TPAEnum.prototype.getFirst = function(d) {
    if (! ("mAliasToNode" in this)) {
        this.initVariable(d)
    }
    for (var b in this.mAliasToNode) {
        return this.mAliasToNode[b]
    }
    return null
};
TPAEnum.prototype.initVariable = function(b) {
    this.mSelected = null;
    this.mSelectedIdx = null;
    this.mNumIndexes = 0;
    this.mNumToAlias = {};
    this.mAliasToNode = {};
    this.mLabelToNode = {};
    var d = this.GetElementForARType(b);
    this.iterate(function(k, f) {
        var h = k.nextSibling.firstChild.data;
        h = h.replaceNBSP();
        this.mNumToAlias[k.value] = h;
        this.mAliasToNode[h] = k;
        var g = k.getAttribute("arvalue");
        if (g) {
            this.mLabelToNode[g] = k
        }
        this.mNumIndexes++;
        if (k.checked) {
            this.mSelected = k;
            this.mSelectedIdx = k.value
        }
    },
    d)
};
DEnumSel.prototype.TabableElementSelector = function(f) {
    var b = this.mObj.childNodes[2];
    var d = b.className.indexOf("dat");
    if (f.tagName == "A" && d != -1 && this.GAccess() != 2) {
        return null
    }
    return DEnumSel.superclass.TabableElementSelector.call(this, f)
};
TPAEnumSel.prototype.DOMClick = DEnumSel.prototype.DOMClick = function(d, f) {
    DEnumSel.superclass.DOMClick.call(this, d);
    if (this.GAccess() != 2) {
        return
    }
    if (this instanceof TPAEnumSel) {
        var k = this.FindContainingDiv(d.element);
        this.cmid = f;
        this.curevt = d
    }
    if (!this.mMenu || this instanceof TPAEnumSel) {
        if (this instanceof TPAEnumSel) {
            this.mInputNode = k.childNodes[1];
            this.buildEnumSelMenu()
        }
        var h = this.mMenuDef;
        var b = this.mOrder;
        var o = [];
        for (var g = 0; g < b.length; g++) {
            o.push({
                v: h[b[g]].l,
                l: h[b[g]].l
            })
        }
        o.push(DEnumSel.getClearValue());
        this.mMenu = new SelectionMenu(this, o)
    }
    if (this instanceof TPAEnumSel) {
        return {
            n: {
                f: this.mMenu.Open,
                a: [k],
                t: this.mMenu
            }
        }
    } else {
        return {
            n: {
                f: this.mMenu.Open,
                a: [this.mObj.childNodes[2]],
                t: this.mMenu
            }
        }
    }
};
TPAEnumSel.prototype.buildEnumSelMenu = function() {
    var g = F(this.windowID, this.cmid);
    if ("e" in g.mObj) {
        var k = g.mObj.e;
        var h = [];
        var d = [];
        var b = 0;
        for (var f in k) {
            h[f] = {};
            h[f].ord = b;
            h[f].v = k[f].v.ValidatorUnEscape();
            h[f].l = k[f].l.ValidatorUnEscape();
            d[b++] = f
        }
        this.mMenuDef = h;
        this.mOrder = d
    }
};
DEnumSel.prototype.DOMKeyDown = function(b) {
    if (this.GAccess() != 2) {
        return
    }
    var d = b.key;
    if (d == 38 || d == 40 || d == 37 || d == 39) {
        var f = this.G();
        if (f.isNull) {
            f = (d == 38 || d == 37) ? this.GetLast() : this.GetFirst()
        } else {
            f = f.toInteger();
            f = (d == 38 || d == 37) ? this.GetPrev(f) : this.GetNext(f)
        }
        if (f == -1) {
            this.S(Null)
        } else {
            this.S(new EnumType(f, ExpandString(this.windowID, this.mMenuDef[f].l, 2 | 4)))
        }
        b.StopDefault();
        return ExecuteWorkflow(this.windowID, 2, this.mID)
    }
};
TPAEnumSel.prototype.HandleMenuSelection = DEnumSel.prototype.HandleMenuSelection = function(d) {
    var b = this.mInputNode;
    b.value = d;
    this.FieldValChanged();
    if (this instanceof DEnumSel) {
        this.SetDirty(b)
    }
    if ((this.cmid != null) && (this.curevt != null)) {
        if ((this.cmid in getFields_NS(this.windowID)) && (getFields_NS(this.windowID)[this.cmid].mObj.pnt in getFields_NS(this.windowID))) {
            getFields_NS(this.windowID)[getFields_NS(this.windowID)[this.cmid].mObj.pnt].HandleEnumSelValChanged(this.curevt, d)
        }
    }
    this.DoSet(new CharType(d))
};
DEnumSel.prototype.DOMFocus = function(b) {
    var d = this.mObj.childNodes[2];
    var f = d.className.indexOf("dat");
    if (f != -1 && this.GAccess() == 2) {
        this.mDAT = 1;
        d.className = d.className.replace(/(\s*dat)/g, "")
    }
    return DEnumSel.superclass.DOMFocus.call(this, b)
};
DEnumSel.prototype.DOMBlur = function(b) {
    if (this.mDAT) {
        delete this.mDAT;
        this.mObj.childNodes[2].className += " dat"
    }
    return DEnumSel.superclass.DOMBlur.call(this, b)
};
TPAEnumSel.prototype.resetFocusTab = DEnumSel.prototype.resetFocusTab = function(f) {
    if (f.tagName != "INPUT") {
        return
    }
    if (this.mDataVal && this.mDataVal.isNull) {
        return
    }
    var b = this.mObj.childNodes[2];
    var d = b.className.indexOf("dat");
    if (d != -1 && this.GAccess() == 1) {
        return
    }
    f.select()
};
DEnum.prototype.init = function(b, f, d) {
    this.mSelected = null;
    this.mSelectedIdx = null;
    this.mNumIndexes = 0;
    this.mNumToAlias = {};
    this.mAliasToNode = {};
    this.mLabelToNode = {};
    this.iterate(function(o, g) {
        var k = o.nextSibling.firstChild.data;
        k = k.replaceNBSP();
        this.mNumToAlias[o.value] = k;
        this.mAliasToNode[k] = o;
        var h = o.getAttribute("arvalue");
        if (h) {
            this.mLabelToNode[h] = o
        }
        this.mNumIndexes++;
        if (o.checked) {
            this.mSelected = o;
            this.mSelectedIdx = o.value
        }
    },
    d);
    DEnum.superclass.init.call(this, b, f, d)
};
TPAEnum.prototype.iterate = JEnum.prototype.iterate = DEnum.prototype.iterate = function(k, f) {
    var h = f ? f: this.mObj.childNodes[2];
    var b = 0;
    var g = h;
    while (1) {
        if (h.nodeType == 1 && h.tagName == "INPUT") {
            b = h.value;
            var d = k.call(this, h, b);
            if (typeof d != "undefined") {
                return d
            }
        }
        if (h.firstChild) {
            h = h.firstChild
        } else {
            while (!h.nextSibling) {
                h = h.parentNode;
                if (h == g) {
                    return
                }
            }
            h = h.nextSibling
        }
    }
};
DEnum.prototype.GetDataPortion = function() {
    return this.mObj.getElementsByTagName("fieldset")[0]
};
DEnum.prototype.TabableElementSelector = function(b) {
    if (b.tagName == "INPUT") {
        if (this.mSelected == b) {
            return b
        }
        var d = this.getFirst();
        if (d && this.mSelected == null && d == b) {
            return b
        }
        if (d && d == b && b.type == "checkbox" && this.mSelected != null) {
            return b
        }
    }
    return null
};
DEnum.prototype.GetFocusElementForEvent = function(b) {
    if (this.GetNestedFocusability()) {
        var d = b.element;
        if (d.tagName == "LABEL") {
            d = d.previousSibling;
            if (d == null) {
                return null
            }
        }
        if (d.tagName == "INPUT") {
            return d
        } else {
            return DEnum.superclass.GetFocusElementForEvent.call(this, b)
        }
    }
    return null
};
DEnum.prototype.DOMClick = function(b) {
    DEnum.superclass.DOMClick.call(this, b);
    if (this.GAccess() != 2) {
        return
    }
    var g = b.element;
    var f = this.mSelected;
    this.mSelected = null;
    this.mSelectedIdx = null;
    if ((g.tagName == "INPUT") && (f == g)) {
        f.checked = false
    } else {
        for (var d in this.mAliasToNode) {
            var h = this.mAliasToNode[d];
            if (h.checked && this.mSelected == null) {
                this.mSelected = h;
                this.mSelectedIdx = h.value
            } else {
                h.checked = false
            }
        }
    }
    if (this.mSelected != f) {
        this.FieldValChanged();
        this.SetDirty((this.mSelected != null) ? this.mSelected: f);
        return ExecuteWorkflow(this.windowID, 2, this.mID)
    }
};
DEnum.prototype.GetFocusElement = function() {
    if (this.mSelected) {
        return this.mSelected
    } else {
        return DEnum.superclass.GetFocusElement.call(this)
    }
};
DEnum.prototype.getPrev = function(g) {
    if (g.tagName != "INPUT") {
        return null
    }
    var f = g.value;
    var d = null;
    for (var b in this.mNumToAlias) {
        if (b == f) {
            break
        } else {
            d = this.mNumToAlias[b]
        }
    }
    if (d == null) {
        return this.getLast()
    } else {
        return this.mAliasToNode[d]
    }
};
DEnum.prototype.getNext = function(h) {
    if (h.tagName != "INPUT") {
        return null
    }
    var g = h.value;
    var b = null;
    var f = false;
    for (var d in this.mNumToAlias) {
        if (d == g) {
            f = true
        } else {
            if (f == true) {
                b = this.mNumToAlias[d];
                break
            }
        }
    }
    if (b != null) {
        return this.mAliasToNode[b]
    } else {
        return this.getFirst()
    }
};
DEnum.prototype.getFirst = function() {
    for (var b in this.mAliasToNode) {
        return this.mAliasToNode[b]
    }
    return null
};
DEnum.prototype.getLast = function() {
    var d = null;
    for (var b in this.mAliasToNode) {
        d = this.mAliasToNode[b]
    }
    return d
};
DEnum.prototype.DOMKeyDown = function(b) {
    if (this.GAccess() != 2) {
        return
    }
    var f = b.key;
    if (f == 37 || f == 39 || f == 38 || f == 40) {
        var h = this.G();
        var d = null;
        if (h.isNull) {
            d = this.getFirst()
        } else {
            if (f == 37 || f == 38) {
                d = this.getPrev(this.mAliasToNode[this.mNumToAlias[h.mValue]])
            } else {
                d = this.getNext(this.mAliasToNode[this.mNumToAlias[h.mValue]])
            }
        }
        d = d.value;
        this.S(new EnumType(d));
        if (f == 37 || f == 39 || f == 38 || f == 40) {
            for (var g in this.mAliasToNode) {
                var k = this.mAliasToNode[g];
                if (k.value == d) {
                    k.focus()
                }
            }
        }
        b.StopDefault();
        return ExecuteWorkflow(this.windowID, 2, this.mID)
    }
};
DEnumSel.prototype.HighlightBorder = function() {
    var b = this.mInputNode.parentNode;
    b.className += " bHighlight";
    getStateMgr_NS(this.windowID).highlightedFlds.push(this.mID)
};
DEnumSel.prototype.RemoveHighlightBorder = function() {
    this.mInputNode.parentNode.className = this.mInputNode.parentNode.className.replace("bHighlight", "")
};
var PageHolderFactories = {};
TabView.prototype.constructor = TabView;
TabView.prototype.constructor = TabView;
function TabView(b) {
    this.init(b)
}
PageHolderFactories.TabView = function(b) {
    return new TabView(b)
};
TabView.prototype.init = function(b) {
    this.mParentObj = b;
    this.mObj = this.mParentObj.mObj;
    this.mID = this.mParentObj.mID;
    this.windowID = this.mParentObj.windowID;
    var o = this.mObj;
    this.mTabs = [];
    this.mTabStack = [];
    this.mChildren = [];
    this.mMissingBorderObj = null;
    this.mScrollingTabs = [];
    this.mTabH = parseInt(o.getAttribute("armaxh"));
    this.mViewPort;
    this.mCanvas;
    this.mLastVisibleTab;
    this.mFirstVisibleTab = 0;
    this.mOuterTab = null;
    this.mMissingBorder = null;
    this.mInitialLayout = true;
    var d = parseInt(o.style.height) - this.mTabH;
    if (d < 0) {
        d = 0
    }
    for (var k = o.firstChild; k; k = k.nextSibling) {
        if (k.nodeType == 1) {
            if (k.className == "TabChildMissingBorder") {
                this.mMissingBorderObj = k
            } else {
                if (k.className.indexOf("TabChild") == 0) {
                    getFlashURL(k, this.mID);
                    this.mChildren.push(k);
                    k.style.top = this.mTabH;
                    k.style.height = d
                } else {
                    if (k.className.indexOf("OuterTabsDiv") == 0) {
                        this.mOuterTab = k;
                        for (var h = k.firstChild; h; h = h.nextSibling) {
                            if (h.nodeType == 1) {
                                if (h.className.indexOf("ScrollingTab") == 0) {
                                    this.mScrollingTabs.push(h)
                                } else {
                                    if (h.className.indexOf("TabsViewPort") == 0) {
                                        this.mViewPort = h;
                                        var f = h.getElementsByTagName("DL")[0];
                                        this.mCanvas = f.parentNode;
                                        if (f.className.indexOf("OuterOuterTab") == 0) {
                                            for (var g = f.firstChild; g; g = g.nextSibling) {
                                                if (g.nodeType == 1 && g.className == "OuterTab") {
                                                    g.setAttribute("arwindowid", this.windowID);
                                                    this.mTabs.push(g)
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    } else {
                        if (k.className.indexOf("OuterOuterTab") != 0) {
                            k.style.zIndex = parseInt(k.style.zIndex) + 5000;
                            k.style.top = parseInt(k.style.top) + this.mTabH + 1;
                            k.style.left = parseInt(k.style.left) + 1
                        }
                    }
                }
            }
        }
    }
    this.mItems = this.mTabs.length;
    this.mSelectedTab = -1
};
TabView.prototype.SelectTab = function(b) {
    if (b != this.mSelectedTab) {
        this.mSelectedTab = b;
        if (this.mParentObj) {
            this.mParentObj.mAsyncDirty = (1 > this.mParentObj.mAsyncDirty ? 1 : this.mParentObj.mAsyncDirty)
        }
    }
};
TabView.prototype.ResizeChildren = function() {
    if (this.mParentObj.mContainerID != null || this.mParentObj.mFloat == 2) {
        var b = this.mObj.offsetHeight - this.mTabH;
        if (this.mMissingBorderObj && this.mMissingBorderObj.style.width != "100%") {
            this.mMissingBorderObj.style.width = "100%"
        }
        if (this.mOuterTab && this.mOuterTab.style.width != "100%") {
            this.mOuterTab.style.width = "100%"
        }
        for (var d in this.mChildren) {
            if (this.mChildren[d].style.width != "100%") {
                this.mChildren[d].style.width = "100%"
            }
            this.mChildren[d].style.height = (b < 0) ? 0 : b
        }
        if (this.mParentObj.mAsyncMode == 0) {
            this.DoLayout();
            return
        }
        this.ResizeChildrenInSelectedTab()
    }
};
TabView.prototype.DoLayout = function() {
    if (this.mItems <= 0) {
        return
    }
    if (this.mOuterTab != null) {
        this.mOuterTab.style.visibility = "inherit"
    }
    if (this.mMissingBorder != null) {
        this.mMissingBorder.style.visibility = "inherit"
    }
    if (this.mTabH != 0 && this.mFirstVisibleTab != -1) {
        this.mTabs[this.mFirstVisibleTab].firstChild.className = "TabLeft";
        this.mFirstVisibleTab = -1;
        if ((typeof this.mLastVisibleTab != "undefined")) {
            var u = this.mTabs[this.mLastVisibleTab].getElementsByTagName("Span");
            if (u != null && u.length > 2) {
                u[2].className = "TabRight"
            }
        }
    }
    var o = 0,
    q = 0,
    s = -1,
    k = false;
    for (var p = 0; p < this.mItems; ++p) {
        var A = this.mTabs[p],
        b = this.mChildren[p];
        if (A.className.indexOf("OuterTabSelected") != -1) {
            A.style.width = "";
            var h = b.style.zIndex;
            b.style.zIndex = h - 1;
            A.className = A.className.replace(/OuterTabSelected/, "OuterTab");
            b.style.visibility = "hidden";
            if (getCurWFC_NS(this.windowID)) {
                AsyncField_IncrAsyncRef(this.windowID, b.getAttribute("arid"), 1)
            }
        }
        if (this.mTabH == 0) {
            A.style.visibility = "hidden"
        } else {
            A.style.top = 1
        }
        A.style.zIndex = 1;
        A.style.left = o;
        if (b.getAttribute("arvisibility") == "hidden") {
            A.style.visibility = "hidden";
            A.style.display = "none";
            if (this.mSelectedTab == p) {
                k = true
            }
            b.style.left = p * 2000
        } else {
            if (this.mFirstVisibleTab == -1) {
                A.firstChild.className = "TabLeftRounded";
                this.mFirstVisibleTab = p
            }
            b.style.left = 0;
            if (this.mTabH != 0) {
                A.style.visibility = "inherit";
                A.style.display = "block"
            }
            if (s == -1) {
                s = p
            }
        }
        var d = A.childNodes[2].offsetWidth + 10;
        o += d;
        if (this.mTabs[p].style.visibility != "hidden") {
            q += d;
            this.mLastVisibleTab = p
        }
    }
    if (k || this.mSelectedTab == -1) {
        this.mSelectedTab = s
    }
    if (this.mSelectedTab == -1) {
        if (this.mMissingBorderObj != null) {
            this.mMissingBorderObj.style.visibility = "hidden"
        }
        for (var y = 0; y < this.mScrollingTabs.length; y++) {
            this.mScrollingTabs[y].style.display = "none"
        }
        return
    } else {
        if (this.mMissingBorderObj != null) {
            this.mMissingBorderObj.style.visibility = "inherit"
        }
    }
    var A = this.mTabs[this.mSelectedTab],
    b = this.mChildren[this.mSelectedTab];
    A.style.top = (this.mTabH == 0 ? -1000 : 1);
    A.style.zIndex = 3;
    b.style.visibility = "inherit";
    var h = parseInt(b.style.zIndex);
    if (!isNaN(h)) {
        b.style.zIndex = h + 1
    }
    A.className = A.className.replace(/OuterTab/, "OuterTabSelected");
    var w = parseInt(this.mObj.style.width);
    if (this.mTabH != 0) {
        var v = 0;
        if (q <= w) {
            for (var y = 0; y < this.mScrollingTabs.length; y++) {
                this.mScrollingTabs[y].style.display = "none"
            }
        } else {
            for (var y = 0; y < this.mScrollingTabs.length; y++) {
                this.mScrollingTabs[y].style.display = "block";
                v += this.mScrollingTabs[y].offsetWidth
            }
        }
        if (w - v < 0) {
            if (getCurWFC_NS(this.windowID)) {
                AsyncField_IncrAsyncRef(this.windowID, b.getAttribute("arid"), -1)
            }
            return
        } else {
            this.mViewPort.style.width = w - v - 1
        }
        this.mViewPortWidth = w - v;
        this.mCanvas.style.width = (q > this.mViewPortWidth ? q: this.mViewPortWidth);
        var g = parseInt(this.mCanvas.style.left);
        if (g < 0 && g < w - v - q) {
            g = (w - v) - q;
            this.mCanvas.style.left = (g < 0 ? g: 0)
        }
        if (g == 0) {
            this.mScrollingTabs[0].disabled = true;
            this.mScrollingTabs[0].childNodes[3].firstChild.style.color = "gray"
        }
        if (this.mViewPortWidth - g < q) {
            this.mScrollingTabs[1].disabled = false;
            this.mScrollingTabs[1].childNodes[3].firstChild.style.color = ""
        }
        var f = this.mTabs[this.mLastVisibleTab];
        var u = f.getElementsByTagName("Span");
        if (u != null) {
            if (u != null && u.length > 2) {
                u[2].className = "TabRightRounded"
            }
        }
    }
    if (getCurWFC_NS(this.windowID)) {
        AsyncField_IncrAsyncRef(this.windowID, b.getAttribute("arid"), -1)
    }
    this.ResizeChildrenInSelectedTab();
    this.mInitialLayout = false
};
TabView.prototype.ResizeChildrenInSelectedTab = function() {
    var b = (this.mSelectedTab != -1) ? parseInt(this.mChildren[this.mSelectedTab].getAttribute("arid")) : -1;
    if (b != -1) {
        getFields_NS(this.windowID)[b].ResizeChildren()
    }
};
TabView.prototype.G = function() {
    if (this.mSelectedTab == -1) {
        for (var b = 0; b < this.mChildren.length; b++) {
            if (this.mChildren[b].getAttribute("arvisibility") != "hidden") {
                return new CharType(this.mChildren[b].getAttribute("ardbn"))
            }
        }
        return Null
    }
    if (typeof this.mSelectedTab != "undefined") {
        return new CharType(this.mChildren[this.mSelectedTab].getAttribute("ardbn"))
    }
    return Null
};
TabView.prototype.DoSet = TabView.prototype.DoSLoadEntry = function(f) {
    f = f.toString();
    for (var b = 0; b < this.mItems; ++b) {
        var d = this.mChildren[b];
        if (d.getAttribute("ardbn") == f && d.getAttribute("arvisibility") != "hidden") {
            this.SelectTab(b);
            return
        }
    }
};
TabView.prototype.TabableElementSelector = function(d) {
    if (d.tagName == "A") {
        var b = d.parentNode.parentNode;
        if (this.mTabs[this.mSelectedTab == -1 ? 0 : this.mSelectedTab] == b) {
            return d
        }
    }
    return null
};
TabView.prototype.GetTabForID = function(b) {
    var f = b + "";
    for (var d = 0; d < this.mItems; ++d) {
        if (this.mTabs[d].getAttribute("artabid") == f) {
            return this.mTabs[d]
        }
    }
    return null
};
TabView.prototype.GetTextElement = function(b) {
    return this.GetTabForID(b).childNodes[2].childNodes[0]
};
TabView.prototype.GetTabIndexForID = function(b) {
    var f = b + "";
    for (var d = 0; d < this.mItems; ++d) {
        if (this.mTabs[d].getAttribute("artabid") == f) {
            return d
        }
    }
    return null
};
TabView.prototype.GetFocusElementForEvent = function(b) {
    if (this.mParentObj.GetNestedFocusability()) {
        var f = b.element;
        for (var d = 0; d < this.mItems; ++d) {
            if (this.mTabs[d] == f || this.mTabs[d].childNodes[2] == f || this.mTabs[d].childNodes[2].childNodes[0] == f) {
                return this.mTabs[d].childNodes[2].childNodes[0]
            }
        }
        if (f.id == "prevTab" || f.id == "nextTab") {
            return f
        }
    }
    return null
};
TabView.prototype.DragHandler = function(b) {};
TabView.prototype.DOMClick = function(b) {
    var d = b.element;
    if (d.id == "prevTab") {
        this.scrollTabsLeftward()
    } else {
        if (d.id == "nextTab") {
            this.scrollTabsRightward()
        }
    }
};
TabView.prototype.scrollTabsLeftward = function(p) {
    if (this.isTablessBorderless()) {
        return
    }
    if (!this.mScrollingTabs[0].disabled) {
        this.mScrollingTabs[1].disabled = false;
        this.mScrollingTabs[1].childNodes[3].firstChild.style.color = "";
        var f = parseInt(this.mCanvas.style.left);
        var g = 0;
        var b = this.mTabs.length;
        var o;
        var d;
        for (var h = 0; h < b; h++) {
            o = h;
            if (this.mTabs[o].style.visibility != "hidden") {
                var k = this.mTabs[o].childNodes[2].offsetWidth + 10;
                if (h == 0 || h == b - 1) {
                    k -= 2
                }
                if (g + k >= -f || p == h) {
                    d = this.mTabStack.length;
                    this.mCanvas.style.left = ((d > 0) ? this.mTabStack.pop() : -(k * (d + 1)));
                    if (this.mTabStack.length == 0) {
                        this.mScrollingTabs[0].disabled = true;
                        this.mScrollingTabs[0].childNodes[3].firstChild.style.color = "gray"
                    }
                    break
                }
                g += k
            }
        }
    }
};
TabView.prototype.scrollTabsRightward = function(o) {
    if (this.isTablessBorderless()) {
        return
    }
    if (!this.mScrollingTabs[1].disabled) {
        this.mScrollingTabs[0].disabled = false;
        this.mScrollingTabs[0].childNodes[3].firstChild.style.color = "";
        var f = 0,
        d = 0;
        f = d = parseInt(this.mCanvas.style.left);
        var b = this.mTabs.length;
        var k;
        for (var g = 0; g < b; g++) {
            k = g;
            if (this.mTabs[k].style.visibility != "hidden") {
                var h = this.mTabs[k].childNodes[2].offsetWidth + 10;
                if (g == 0 || g == b - 1) {
                    h -= 2
                }
                f += h;
                if (f > this.mViewPortWidth) {
                    this.mTabStack.push(parseInt(this.mCanvas.style.left));
                    this.mCanvas.style.left = -(h * (this.mTabStack.length)) + 5;
                    if (g == this.mLastVisibleTab) {
                        this.mScrollingTabs[1].disabled = true;
                        this.mScrollingTabs[1].childNodes[3].firstChild.style.color = "gray"
                    }
                    if (o == undefined || o == g) {
                        break
                    }
                }
            }
        }
    }
};
TabView.prototype.DOMKeyDown = function(b) {
    var d = -1;
    if (b.key == 39) {
        for (var f = this.mSelectedTab + 1; f < this.mTabs.length; f++) {
            if (this.mChildren[f].getAttribute("arvisibility") != "hidden") {
                d = this.mTabs[f].getAttribute("artabid");
                break
            }
        }
    } else {
        if (b.key == 37) {
            var f = (this.mSelectedTab > 0) ? this.mSelectedTab - 1 : ((this.mTabs.length > 0) ? 0 : -1);
            for (; f >= 0; f--) {
                if (this.mChildren[f].getAttribute("arvisibility") != "hidden") {
                    d = this.mTabs[f].getAttribute("artabid");
                    break
                }
            }
        }
    }
    if (d > 0) {
        do {
            if (! (d.isDigits())) {
                Assert("(PageHolder.js:538) newTabId.isDigits()")
            }
        } while ( 0 );
        d = parseInt(d);
        b.mStoppedDefault = true;
        return {
            c: {
                t: FocusMgr,
                f: FocusMgr.SetFocusToField,
                a: [this.windowID, d]
            }
        }
    }
};
TabView.prototype.DOMFocus = function(b) {
    var d = b.element;
    if (d.tagName == "A") {
        if (d.id == "nextTab" || d.id == "prevTab") {
            return
        }
        d = d.parentNode.parentNode
    }
    return {
        c: {
            f: ExecuteWorkflow,
            a: [this.windowID, 8192, this.mID]
        },
        n: {
            t: this,
            f: this.domFocusP2,
            a: [d]
        }
    }
};
TabView.prototype.domFocusP2 = function(d) {
    var f = (this.mSelectedTab != -1) ? parseInt(this.mChildren[this.mSelectedTab].getAttribute("arid")) : -1;
    var b = (d.className.indexOf("TabChild") == 0) ? parseInt(d.getAttribute("arid")) : d.className.indexOf("Tab") == 0 ? parseInt(d.parentNode.getAttribute("artabid")) : parseInt(d.getAttribute("artabid"));
    if ((f != b) && (f != -1) && (f == FocusMgr.mCurFocusID)) {
        return {
            c: {
                f: ExecuteWorkflow,
                a: [this.windowID, 256, f]
            },
            n: {
                t: this,
                f: this.domFocusP3,
                a: [b],
                e: this.focusExceptionHandler,
                ea: [this.mSelectedTab]
            }
        }
    } else {
        return {
            n: {
                t: this,
                f: this.domFocusP3,
                a: [b],
                e: this.focusExceptionHandler,
                ea: [this.mSelectedTab]
            }
        }
    }
};
TabView.prototype.focusExceptionHandler = function(b, d) {
    this.SelectTab(d);
    throw b
};
TabView.prototype.domFocusP3 = function(h) {
    var q = h + "";
    for (var d = 0; d < this.mItems; ++d) {
        if (this.mTabs[d].getAttribute("artabid") == q) {
            var b = this.mSelectedTab;
            this.SelectTab(d);
            if (!this.isTablessBorderless()) {
                if (!this.mViewPortWidth) {
                    var s = parseInt(this.mObj.style.width);
                    var o = 0;
                    for (var v = 0; v < this.mScrollingTabs.length; v++) {
                        o += this.mScrollingTabs[v].offsetWidth
                    }
                    this.mViewPortWidth = s - o
                }
                var f = this.mTabs[d].offsetLeft;
                var p = f + this.mTabs[d].offsetWidth;
                var g = this.mViewPortWidth;
                var k = parseInt(this.mCanvas.style.left);
                var u = -k + g;
                if (f < -k) {
                    this.scrollTabsLeftward(d)
                } else {
                    if (p > u) {
                        this.scrollTabsRightward(d)
                    }
                }
            }
            return {
                c: {
                    f: ExecuteWorkflow,
                    a: [this.windowID, 256, this.mID]
                },
                n: {
                    t: this,
                    f: this.domFocusP4,
                    a: [h],
                    e: this.focusExceptionHandler,
                    ea: [b]
                }
            }
        }
    }
};
TabView.prototype.domFocusP4 = function(b) {
    FocusMgr.mCurFocusID = b;
    FocusMgr.mCurFocusWindowID = this.windowID;
    return {
        c: {
            f: ExecuteWorkflow,
            a: [this.windowID, 8192, b]
        }
    }
};
TabView.prototype.GetFocusElement = function() {
    return this.mSelectedTab != -1 ? this.mTabs[this.mSelectedTab].childNodes[2].childNodes[0] : this.mTabs.length > 0 ? this.mTabs[0].childNodes[2].childNodes[0] : null
};
TabView.prototype.getFocusElementForTab = function(b) {
    var d = this.GetTabForID(b);
    if (d != null) {
        return d.childNodes[2].childNodes[0]
    }
    return null
};
TabView.prototype.IsPageVisible = function(d) {
    var b = this.GetTabForID(d.mID);
    return (b && b.className.indexOf("OuterTabSelected") != -1)
};
TabView.prototype.registerPageField = function(b) {};
TabView.prototype.HeaderClick = function(b, d) {};
TabView.prototype.UpdatePageVis = function(d, b) {
    if (!d && this.mSelectedTab != -1 && this.mChildren[this.mSelectedTab].getAttribute("arid") == b.mID) {
        this.mSelectedTab = -1
    }
    if (this.mParentObj) {
        this.mParentObj.mAsyncDirty = (1 > this.mParentObj.mAsyncDirty ? 1 : this.mParentObj.mAsyncDirty)
    }
};
TabView.prototype.HandleState = function(b, d) {};
TabView.prototype.isTablessBorderless = function() {
    return (this.mScrollingTabs.length == 0)
};
StackSplitterPane.prototype.constructor = StackSplitterPane;
var PageDirty = false;
function StackSplitterPane(d, b) {
    if (arguments.length) {
        this.init(d, b)
    }
}
StackSplitterPane.prototype.init = function(d, b) {
    this.mObj = d;
    this.position = 0;
    this.mOrientation = b;
    this.mSize = parseInt((b == "horizontal") ? d.style.width: d.style.height);
    if (isNaN(this.mSize)) {
        this.mSize = 5
    }
};
StackSplitterPane.prototype.setPosition = function(b) {
    this.position = b;
    if (this.mOrientation == "horizontal") {
        this.mObj.style.left = b
    } else {
        this.mObj.style.top = b
    }
};
ContentPane.prototype.constructor = ContentPane;
function ContentPane(h, g, d, b, f) {
    this.init(h, g, d, b, f)
}
ContentPane.prototype.init = function(h, g, d, b, f) {
    this.mObj = h;
    this.mParent = g;
    this.mOrientation = d;
    this.mViewType = b;
    this.mHeader = false;
    this.position = 0;
    this.mIndex = f;
    this.mMinSize = parseInt(this.mObj.getAttribute("arminsize"));
    if (this.mMinSize == 0) {
        this.mMinSize = 25
    }
    this.mMaxSize = parseInt(this.mObj.getAttribute("armaxsize"));
    this.mInitSize = parseInt(this.mObj.getAttribute("arinitsize"));
    this.mSlackOrder = parseInt(this.mObj.getAttribute("arslackorder"));
    this.mWhitespace = this.mObj.getAttribute("arwhitespace") == 1;
    this.sizeActual = parseInt((d == "horizontal") ? this.mObj.style.width: this.mObj.style.height);
    this.mFitSize = this.mInitSize;
    if (this.mMaxSize == 0) {
        this.mMaxSize = this.mInitSize + 10
    }
    if (this.sizeActual == 0) {
        this.sizeActual = 10
    }
    this.sizeShare = this.sizeActual;
    this.mID = this.mObj.getAttribute("arid");
    this.mPageField = null;
    this.mVisible = (this.mObj.getAttribute("arvisibility") == "visible")
};
ContentPane.prototype.resize = function(d, b) {
    this.position = d;
    this.sizeActual = this.sizeShare = b;
    this.redraw()
};
ContentPane.prototype.resizeByPosition = function(b) {
    this.position = b;
    this.redraw()
};
ContentPane.prototype.resizePane = function(b) {
    if (this.mPageField) {
        this.mPageField.changeSize(b)
    }
};
ContentPane.prototype.redraw = function() {
    if (this.mOrientation == "horizontal") {
        this.mObj.style.left = this.position;
        this.mObj.style.width = this.sizeActual
    } else {
        this.mObj.style.top = this.position;
        this.mObj.style.height = this.sizeActual
    }
    if (this.mPageField) {
        this.mPageField.changeSize(this.sizeActual)
    }
};
StackView.prototype.constructor = StackView;
function StackView(b) {
    this.init(b)
}
PageHolderFactories.StackView = function(b) {
    return new StackView(b)
};
StackView.prototype.init = function(b) {
    this.mParentObj = b;
    this.mObj = this.mParentObj.mObj;
    this.mID = this.mParentObj.mID;
    this.windowID = this.mParentObj.windowID;
    this.mRelPosContainer = null;
    var h = this.mObj;
    this.mOrientation = h.getAttribute("arorientation");
    this.mStackViewType = h.getAttribute("arstackviewtype");
    this.mChildren = [];
    this.mVisibleChildren = [];
    this.mSplitters = [];
    this.mSplitterSize = 0;
    this.mPostCreate = false;
    this.mLength = 0;
    this.mAccordionSize = 0;
    this.mInitializeLayout = 0;
    this.mFixedContainer = null;
    this.mDefaults = false;
    this.mInitPageID = this.mObj.getAttribute("arinitpage");
    this.mDraw = false;
    this.mShrink = false;
    this.vSize = 0;
    this.mMargin = h.getAttribute("armargin");
    this.mBorderless = h.getAttribute("arborder");
    for (var g = this.mObj.firstChild; g; g = g.nextSibling) {
        if (g.className == "PageHolderStackViewResizable") {
            h = this.mRelPosContainer = g;
            break
        }
    }
    if (this.mStackViewType == "fixed") {
        for (var g = h.firstChild; g; g = g.nextSibling) {
            if (g.className != null && g.className.indexOf("PageHolderStackViewFixedC") != -1) {
                h = this.mFixedContainer = g;
                break
            }
        }
    }
    var d = 0;
    for (var g = h.firstChild; g; g = g.nextSibling) {
        if (g.nodeType == 1) {
            var f = g.getAttribute("artype");
            if (f != null && f == "Page") {
                this.mChildren.push(new ContentPane(g, this, this.mOrientation, this.mStackViewType, d++))
            }
        }
    }
};
StackView.prototype.addSplitter = function(f) {
    var d = this.mSplitters.length;
    var g = document.createElement("div");
    if (f) {
        g.setAttribute("dragHandler", "PageHolder_DragHandler");
        g.setAttribute("draggable", "1")
    } else {
        g.style.cursor = "auto"
    }
    g.className = (this.mOrientation == "horizontal") ? "PageHolderSplitterH": "PageHolderSplitterV";
    g.setAttribute("dragoriginal", "");
    g.setAttribute("arpageholderid", this.mParentObj.mID);
    g.setAttribute("arsplitposition", d);
    g.setAttribute("arwindowid", this.windowID);
    this.mSplitters[d] = new StackSplitterPane(g, this.mOrientation);
    if (this.mSplitterSize == 0) {
        this.mSplitterSize = this.mSplitters[0].mSize
    }
    var b = (this.mRelPosContainer != null) ? this.mRelPosContainer: this.mObj;
    b.appendChild(g)
};
StackView.prototype.calcAccordionPaneSize = function() {
    var g = (this.mRelPosContainer != null) ? this.mRelPosContainer: this.mObj;
    var f = (this.mOrientation == "horizontal") ? g.offsetWidth: g.offsetHeight;
    if (f == 0) {
        f = (this.mOrientation == "horizontal") ? parseInt(g.parentNode.style.width) : parseInt(g.parentNode.style.height)
    }
    var b = 20;
    var h = 0;
    for (var d = 0; d < this.mChildren.length; d++) {
        if (this.mChildren[d].mVisible) {
            h++
        }
    }
    var k = (h > 0) ? ((h - 1) * b) : 0;
    this.mAccordionSize = f - k;
    this.mAccordionSize -= this.mVisibleChildren.length;
    if (this.mAccordionSize < 30) {
        this.mAccordionSize = 30
    }
};
StackView.prototype.applyFixedLayout = function() {
    if (this.mVisibleChildren.length == 0) {
        return
    }
    var o = (this.mRelPosContainer != null) ? this.mRelPosContainer: this.mObj;
    var d = (this.mOrientation == "horizontal") ? o.offsetWidth: o.offsetHeight;
    var h = this.compareforShrink();
    var A = 0;
    var q = 0;
    var u = false;
    var v = 0;
    var s;
    var y;
    var g = 0;
    var w = this.mVisibleChildren.length - 1;
    var b = this.mVisibleChildren[w];
    while (b.mPageField.mState != 1 && w > 0) {
        b = this.mVisibleChildren[--w]
    }
    if (h) {
        this.vSize = d;
        this.mShrink = true
    }
    for (var k = 0; k < this.mVisibleChildren.length; k++) {
        if (this.mVisibleChildren[k].mPageField.mState == 0) {
            if (this.mVisibleChildren[k].mHeader) {
                q += 20;
                if (h) {
                    A += 20
                }
            }
        } else {
            var f = this.mVisibleChildren[k];
            q += f.mInitSize;
            if (h) {
                A += f.mInitSize
            }
            if (this.mDefaults && f != b) {
                f.resizePane(f.mInitSize)
            } else {
                if (!this.mDefaults && f.mWhitespace) {
                    f.resizePane(f.mFitSize)
                }
            }
        }
    }
    if (this.mShrink) {
        d = this.vSize
    }
    if (h) {
        g = this.applyMargins();
        if (g > 0) {
            A += g
        }
        s = A;
        y = 0
    } else {
        s = d;
        y = d - q
    }
    if (this.mDefaults) {
        v = this.slacktolastPanel(y, b, u)
    } else {
        v = this.allocateSlackToPanes(y)
    }
    if (v < 0) {
        s -= v
    }
    this.setFinalSize(s, h, g)
};
StackView.prototype.applyMargins = function() {
    var d = 0;
    if (this.mMargin) {
        var b = this.mMargin.split(",");
        if (this.mOrientation == "vertical") {
            d = parseInt(b[0]) + parseInt(b[2])
        } else {
            d = parseInt(b[1]) + parseInt(b[3])
        }
    }
    return d
};
StackView.prototype.setFinalSize = function(f, b, d) {
    if (this.mOrientation == "horizontal") {
        this.mFixedContainer.style.width = (d > 0) ? f - d: f
    } else {
        if (this.mFixedContainer.style.height != "auto") {
            this.mFixedContainer.style.height = (d > 0) ? f - d: f
        }
    }
    if (b || this.mShrink) {
        if (this.mOrientation == "horizontal") {
            this.mObj.style.width = (this.mBorderless == "1") ? f + 2 : f
        } else {
            this.mObj.style.height = (this.mBorderless == "1") ? f + 2 : f
        }
    }
};
StackView.prototype.slacktolastPanel = function(b, g, d) {
    if (g.mPageField.mState == 1) {
        var f = g.mInitSize;
        if (b >= 0) {
            f += b
        }
        g.resizePane(((this.mOrientation == "horizontal") && (d == true)) ? (f - 3) : f)
    }
    return b
};
StackView.prototype.getSlackPriority = function() {
    var b = [];
    for (var d = 0; d < this.mVisibleChildren.length; d++) {
        if (this.mVisibleChildren[d].mPageField.mState == 1) {
            var f = this.mVisibleChildren[d];
            var g = f.mSlackOrder;
            if (typeof b[g] == "undefined") {
                b[g] = []
            }
            b[g].push(d)
        } else {
            if (this.mOrientation == "vertical") {
                this.mVisibleChildren[d].mPageField.mFieldSetNode.style.height = this.mVisibleChildren[d].mInitSize
            } else {
                this.mVisibleChildren[d].mPageField.mFieldSetNode.style.width = this.mVisibleChildren[d].mInitSize
            }
        }
    }
    return b
};
StackView.prototype.allocateSlackToPanes = function(f) {
    var b = this.getSlackPriority();
    var q = [];
    var d, g;
    for (var h in b) {
        q.push(h)
    }
    while (f != 0 && q.length != 0) { ((f > 0) ? q.sort(function(p, k) {
            return p - k
        }) : q.sort(function(p, k) {
            return k - p
        }));
        f = this.distributeSlack(f, b[q[0]], q);
        q.shift()
    }
    while (f == 0 && q.length != 0) {
        var o = b[q[0]];
        for (h = 0; h < o.length; h++) {
            d = this.mVisibleChildren[o[h]];
            d.resizePane(d.mInitSize)
        }
        q.shift()
    }
    return f
};
StackView.prototype.distributeSlack = function(y, u, o) {
    var b, h, f, E, g, d, k = u.length;
    var w = 0;
    if (k == 1) {
        f = this.mVisibleChildren[u[0]];
        var D = f.mPageField.mObj.getAttribute("arfillstyle");
        b = (y > 0 ? f.mMaxSize - f.mInitSize: f.mMinSize - f.mInitSize);
        if ((y > 0 && b > y) || (y < 0 && b < y)) {
            b = y
        }
        if (f.mWhitespace) {
            if (b > 0) {
                b = this.fitToContent(f, b);
                b = this.fitPane(b, f, y)
            } else {
                f.resizePane(f.mInitSize + b);
                f.mFitSize = f.mInitSize + b
            }
        }
        if (!f.mWhitespace) {
            f.resizePane(b + f.mInitSize)
        }
        return y - b
    } else {
        var C = new Array(k);
        var q = new Array(k);
        for (h = 0; h < k; h++) {
            f = this.mVisibleChildren[u[h]];
            var D = f.mPageField.mObj.getAttribute("arfillstyle");
            C[h] = (y > 0 ? f.mMaxSize - f.mInitSize: f.mMinSize - f.mInitSize);
            q[h] = 0
        }
        var g = k;
        while (g > 0 && ((y > g - 1) || (y < -(g - 1)))) {
            var B = (y > 0 ? Math.floor(y / g) : Math.ceil(y / g));
            for (h = 0; h < k; h++) {
                if (C[h] != 0) {
                    E = B;
                    if ((B > 0 && C[h] < B) || (B < 0 && C[h] > B) || C[h] == B) {
                        E = C[h];
                        g -= 1
                    }
                    y -= E;
                    q[h] += E;
                    C[h] -= E
                } else {
                    g -= 1
                }
            }
        }
        for (h = 0; h < k; h++) {
            f = this.mVisibleChildren[u[h]];
            var D = f.mPageField.mObj.getAttribute("arfillstyle");
            if (f.mWhitespace) {
                if (y > 0) {
                    q[h] += y;
                    y = 0
                }
                var A = q[h];
                if (q[h] > 0) {
                    q[h] = this.fitToContent(f, q[h]);
                    if (q[h] > A) {
                        q[h] = A
                    }
                    q[h] = this.fitPane(q[h], f, A)
                } else {
                    f.resizePane(f.mInitSize + q[h]);
                    f.mFitSize = f.mInitSize + q[h]
                }
                var d = f.mFitSize - f.mInitSize;
                w = A - d;
                y += w;
                C[h] -= q[h]
            }
        }
        h = 0;
        if (g > 0) {
            E = (y > 0 ? 1 : -1);
            while (h < k && y != 0) {
                if (C[h] != 0) {
                    C[h] -= E;
                    q[h] += E;
                    y -= E
                }
                h++
            }
        }
        for (h = 0; h < k; h++) {
            f = this.mVisibleChildren[u[h]];
            if (!f.mWhitespace) {
                f.resizePane(q[h] + f.mInitSize)
            }
        }
        return y
    }
};
StackView.prototype.fitPane = function(h, k, d) {
    var f = 0,
    g = 0,
    b = 0;
    if (h >= 0) {
        if (k.mFitSize > k.mInitSize) {
            g = k.mFitSize - k.mInitSize;
            b = d - g;
            if (h > b) {
                h = b
            }
            f = h + k.mFitSize;
            k.mFitSize += h;
            h = k.mFitSize - k.mInitSize
        } else {
            if (k.mFitSize <= k.mInitSize) {
                f = h + k.mInitSize;
                k.mFitSize = f
            } else {
                if (d < (k.mFitSize - k.mInitSize)) {
                    h = d;
                    f = h + k.mInitSize;
                    k.mFitSize = f
                }
            }
        }
    }
    k.resizePane(f);
    return h
};
StackView.prototype.getSlackOrder = function() {
    var b = new Array();
    for (var d = 0; d < this.mVisibleChildren.length; d++) {
        if (this.mVisibleChildren[d].mPageField.mState == 1) {
            var f = this.mVisibleChildren[d];
            b[d] = f.mSlackOrder
        }
    }
    return b
};
StackView.prototype.getVisibleChildren = function(d) {
    var b = new Array();
    for (var f = 0; f < this.mVisibleChildren.length; f++) {
        if (d == this.mVisibleChildren[f].mSlackOrder && (this.mVisibleChildren[f].mPageField.mState == 1)) {
            b.push(this.mVisibleChildren[f])
        }
    }
    return b
};
StackView.prototype.avoidWhitespace = function(f, b) {
    var g = 0;
    var d = f.mPageField.mFieldSetNode.childNodes[3];
    if (f.mOrientation == "vertical") {
        if (d.className.indexOf("pageBody") != -1) {
            d.className = "pageBody ft"
        }
        if (d.scrollHeight > d.offsetHeight) {
            g = d.scrollHeight - d.offsetHeight;
            if (g > 0 && g < 3) {
                g = 0
            } else {
                if (g > 3) {
                    g += 3
                }
            }
        }
    } else {
        if (d.scrollWidth > d.offsetWidth) {
            g = d.scrollWidth - d.offsetWidth
        }
    }
    if (g < b) {
        b = g
    }
    if ((b + f.mFitSize) >= f.mMaxSize) {
        b = f.mMaxSize - f.mFitSize
    } else {
        if ((b + f.mFitSize) <= f.mMinSize) {
            b = f.mMinSize - f.mFitSize
        }
    }
    return b
};
StackView.prototype.fitToContent = function(g, d) {
    var f = g.mPageField.mObj.getAttribute("arfillstyle");
    var b = 0;
    if (g.mWhitespace) {
        if (f == "1") {
            if (PageDirty) {
                b = g.mPageField.mScrollHeight;
                g.mPageField.mScrollHeight = 0;
                if (b > d) {
                    b = d
                }
                if ((b + g.mFitSize) >= g.mMaxSize) {
                    b = g.mMaxSize - g.mFitSize
                } else {
                    if ((b + g.mInitSize) <= g.mMinSize) {
                        b = g.mMinSize - g.mInitSize
                    }
                }
            }
            return b
        } else {
            d = this.avoidWhitespace(g, d);
            return d
        }
    }
};
StackView.prototype.comparetodefaults = function() {
    for (var b = 0; b < this.mVisibleChildren.length; b++) {
        var d = this.mVisibleChildren[b];
        if (d.mSlackOrder != 0) {
            return false
        }
    }
    return true
};
StackView.prototype.compareforShrink = function() {
    for (var b = 0; b < this.mChildren.length; b++) {
        var d = this.mChildren[b];
        if (d.mMinSize != d.mMaxSize) {
            return false
        }
    }
    return true
};
StackView.prototype.initLayout = function() {
    if (this.mVisibleChildren.length == 0) {
        return
    }
    var p = (this.mRelPosContainer != null) ? this.mRelPosContainer: this.mObj;
    var f = p.offsetWidth;
    var A = p.offsetHeight;
    var d = (this.mOrientation == "horizontal") ? f: A;
    if (this.mVisibleChildren.length > 1) {
        d -= (this.mSplitterSize * (this.mVisibleChildren.length - 1))
    }
    var g = 0;
    var h = 0;
    for (var q = 0; q < this.mVisibleChildren.length; q++) {
        g += this.mVisibleChildren[q].sizeShare
    }
    var v = this.mVisibleChildren.length;
    var u = new Array();
    var s = new Array();
    var b, w = 0;
    var k = new Array();
    var y = d - g;
    if (this.mDefaults) {
        this.splitterdefaults(d, g, v)
    } else {
        u = this.getSlackOrder();
        ((y > 0) ? u.sort(function(C, B) {
            return C - B
        }) : u.sort(function(C, B) {
            return B - C
        }));
        for (var q = 0; q = u.length; q++) {
            var o = 0;
            if (u[o] == u[o + 1]) {
                k.push(u[o]);
                u.shift()
            } else {
                k.push(u[o]);
                u.shift();
                break
            }
        }
        h = this.resizeSplitter(d, g, u, w);
        this.slacktoPriorityOrder(k, d, h)
    }
    this.layoutPanels()
};
StackView.prototype.slacktoPriorityOrder = function(g, h, b) {
    if (g.length > 1) {
        this.allocateSlacktoSplitter(h, b, g)
    } else {
        for (var f = 0; f < this.mVisibleChildren.length; f++) {
            if (g == this.mVisibleChildren[f].mSlackOrder) {
                var o = h - b;
                var d = this.mVisibleChildren[f].sizeActual;
                var k = this.mVisibleChildren[f].mMaxSize;
                this.mVisibleChildren[f].sizeActual = o;
                o = 0
            }
        }
    }
};
StackView.prototype.allocateSlacktoSplitter = function(o, d, g) {
    var k = 0;
    var p = o - d;
    var h = p / g.length;
    var b = new Array();
    b = this.getVisibleChildren(g[0]);
    for (var f = 0; f < b.length; f++) {
        paneReq = b[f].mMaxSize;
        if (g[0] == b[f].mSlackOrder) {
            si = b[f].sizeActual;
            if (h <= paneReq) {
                if (f == b.length - 1) {
                    b[f].sizeActual = p;
                    p = 0
                } else {
                    b[f].sizeActual = h;
                    p -= h
                }
            } else {
                if (h > paneReq) {
                    if (f == b.length - 1) {
                        b[f].sizeActual = h;
                        p = 0
                    } else {
                        k = h - paneReq;
                        h += k;
                        b[f].sizeActual = paneReq
                    }
                }
            }
        }
    }
};
StackView.prototype.splitterdefaults = function(o, f, d) {
    var k = o / f;
    var b = 0;
    for (var h = 0; h < d - 2; h++) {
        b = this.getActualSize(k, b, h)
    }
    var g = Math.round(k * this.mVisibleChildren[d - 1].sizeShare);
    if (g < this.mVisibleChildren[d - 1].mMinSize) {
        g = this.mVisibleChildren[d - 1].mMinSize
    } else {
        if (g > this.mVisibleChildren[d - 1].mMaxSize) {
            g = this.mVisibleChildren[d - 1].mMaxSize
        }
    }
    this.mVisibleChildren[d - 1].sizeActual = g;
    b += g;
    if (this.mVisibleChildren[d - 2] != null) {
        var p = o - b;
        if (p < this.mVisibleChildren[d - 2].mMinSize) {
            p = this.mVisibleChildren[d - 2].mMinSize
        }
        this.mVisibleChildren[d - 2].sizeActual = p
    }
};
StackView.prototype.resizeSplitter = function(p, g, b, o) {
    var k = p / (g - o);
    var d = 0;
    for (var f = 0; f < this.mVisibleChildren.length; f++) {
        for (var h = 0; h < b.length; h++) {
            if (this.mVisibleChildren[f].mSlackOrder == b[h]) {
                d = this.getActualSize(k, d, f);
                break
            }
        }
    }
    return d
};
StackView.prototype.getActualSize = function(g, b, d) {
    var f = Math.round(g * this.mVisibleChildren[d].sizeShare);
    if (f < this.mVisibleChildren[d].mMinSize) {
        f = this.mVisibleChildren[d].mMinSize
    } else {
        if (f > this.mVisibleChildren[d].mMaxSize) {
            f = this.mVisibleChildren[d].mMaxSize
        }
    }
    this.mVisibleChildren[d].sizeActual = f;
    b += f;
    return b
};
StackView.prototype.layoutPanels = function() {
    var f = 0;
    var d = this.mVisibleChildren[0].sizeActual;
    this.mVisibleChildren[0].resizeByPosition(f);
    f += d;
    for (var b = 1; b < this.mVisibleChildren.length; b++) {
        if (this.mSplitters[b - 1]) {
            this.mSplitters[b - 1].setPosition(f)
        }
        f += this.mSplitterSize;
        this.mVisibleChildren[b].resizeByPosition(f);
        f += this.mVisibleChildren[b].sizeActual
    }
};
StackView.prototype.removeSplitters = function() {
    if (this.mSplitters.length == 0) {
        return
    }
    var b = (this.mRelPosContainer != null) ? this.mRelPosContainer: this.mObj;
    for (var d = (this.mSplitters.length - 1); d >= 0; d--) {
        b.removeChild(this.mSplitters[d].mObj);
        this.mSplitters.pop()
    }
    this.mSplitters = []
};
StackView.prototype.ResizeChildren = function(b) {
    if (this.mParentObj.mFloat == 2 || this.mParentObj.mContainerID != null) {
        this.mInitializeLayout = 1;
        if (this.mParentObj.mAsyncMode && (typeof b == "undefined" || b == false)) {
            if (this.mParentObj) {
                this.mParentObj.mAsyncDirty = (1 > this.mParentObj.mAsyncDirty ? 1 : this.mParentObj.mAsyncDirty)
            }
        } else {
            this.DoLayout()
        }
    }
};
StackView.prototype.DoLayout = function() {
    if (this.mInitializeLayout == 0 || !this.mPostCreate || this.mParentObj.mAsyncDirty) {
        this.mVisibleChildren = [];
        for (var o = 0; o < this.mChildren.length; o++) {
            if (this.mChildren[o].mVisible) {
                this.mVisibleChildren.push(this.mChildren[o])
            }
        }
        this.mDefaults = this.comparetodefaults();
        if (this.mStackViewType && this.mStackViewType == "resizable") {
            this.removeSplitters();
            for (var f = 0; f < this.mVisibleChildren.length; f++) {
                var b = this.mVisibleChildren[f];
                b.mObj.style.position = "absolute";
                if (f == this.mVisibleChildren.length - 1) {
                    break
                }
                if (this.mObj.getAttribute("splitter") == 1) {
                    var h = true;
                    var g = this.mVisibleChildren[f + 1];
                    if (((b.mInitSize == b.mMinSize) && (b.mInitSize == b.mMaxSize)) || ((g.mInitSize == g.mMinSize) && (g.mInitSize == g.mMaxSize))) {
                        h = false
                    }
                    this.addSplitter(h)
                }
            }
            var p = this.mObj.getAttribute("dragHandler");
            if (p == null) {
                this.mObj.setAttribute("dragHandler", "PageHolder_DragHandler");
                this.mObj.setAttribute("arwindowid", this.windowID)
            }
        }
    }
    this.mInitializeLayout = 0;
    this.mDraw = true;
    if (this.mStackViewType && this.mStackViewType == "resizable") {
        this.initLayout()
    } else {
        if (this.mStackViewType && this.mStackViewType == "accordion") {
            this.calcAccordionPaneSize();
            if (this.mPostCreate) {
                for (var d = 0; d < this.mVisibleChildren.length; d++) {
                    if (this.mVisibleChildren[d].mPageField.mState == 1) {
                        this.mVisibleChildren[d].mPageField.changeSize(this.mAccordionSize);
                        break
                    }
                }
            }
        } else {
            this.applyFixedLayout()
        }
    }
    this.mDraw = false;
    if (!this.mPostCreate) {
        this.postCreate()
    }
};
StackView.prototype.DragHandler = function(s) {
    var p = s.srcElement;
    var w = parseInt(p.getAttribute("arsplitposition"));
    if (s.state == 0) {
        var f = this.mSplitters[w];
        var b = this.mVisibleChildren[w];
        var q = this.mVisibleChildren[w + 1];
        var o = (this.mRelPosContainer != null) ? this.mRelPosContainer: this.mObj;
        var h = o.offsetWidth;
        var A = o.offsetHeight;
        var g = 0;
        var y = 0;
        var d = 0;
        var v = 0;
        var k = Math.max((b.position + b.mMinSize), (q.position + (q.sizeActual - q.mMaxSize)));
        var u = Math.min((b.position + b.mMaxSize), (q.position + (q.sizeActual - q.mMinSize))) + this.mSplitterSize;
        if (this.mOrientation == "horizontal") {
            g = k;
            d = u;
            v = A;
            if (! ((s.mx >= k) && (s.mx <= u))) {
                WDEDragContext_Stop()
            }
        } else {
            y = k;
            d = h;
            v = u;
            if (! ((s.my >= k) && (s.my <= u))) {
                WDEDragContext_Stop()
            }
        }
        s.dragContext.SetDragBounds(g, y, d, v)
    } else {
        if (s.state == 2) {
            var f = this.mSplitters[w];
            f.setPosition((this.mOrientation == "horizontal") ? s.x: s.y);
            this.resizePanesAtPos(w)
        }
    }
};
StackView.prototype.resizePanesAtPos = function(k) {
    var b = this.mVisibleChildren[k];
    var g = this.mVisibleChildren[k + 1];
    var o = this.mSplitters[k];
    var p = o.position;
    var f = b.position;
    var h = g.position + g.sizeActual;
    b.sizeActual = p - f;
    g.position = p + this.mSplitterSize;
    g.sizeActual = h - g.position;
    for (var d = 0; d < this.mVisibleChildren.length; d++) {
        this.mVisibleChildren[d].sizeShare = this.mVisibleChildren[d].sizeActual
    }
    b.redraw();
    g.redraw()
};
StackView.prototype.G = function() {
    if (this.mStackViewType && this.mStackViewType == "accordion") {
        for (var b = 0; b < this.mVisibleChildren.length; b++) {
            if (this.mVisibleChildren[b].mPageField.getState() == 1) {
                return new CharType(this.mVisibleChildren[b].mObj.getAttribute("ardbn"))
            }
        }
    }
    return Null
};
StackView.prototype.DoSet = StackView.prototype.DoSLoadEntry = function(b) {};
StackView.prototype.TabableElementSelector = function(b) {
    return null
};
StackView.prototype.GetTabForID = function(d) {
    var h = d + "";
    var b = new Array();
    for (var g = 0; g < this.mChildren.length; ++g) {
        if (this.mChildren[g].mID == h) {
            var k = this.mChildren[g].mPageField.mHeader;
            if (k != null) {
                var f = k.getElementsByTagName("SPAN");
                if (f.length > 0) {
                    if (this.mStackViewType && this.mStackViewType == "fixed") {
                        for (g = 0; g < f.length; g++) {
                            b.push(f[g])
                        }
                        return b
                    } else {
                        for (g = 0; g < f.length; g++) {
                            if (f[g].className.indexOf("label") != -1) {
                                return f[g]
                            }
                        }
                    }
                }
            }
        }
    }
    return null
};
StackView.prototype.GetTextElement = function(b) {
    return this.GetTabForID(b)
};
StackView.prototype.GetTabIndexForID = function(b) {
    return null
};
StackView.prototype.GetFocusElementForEvent = function(b) {
    return null
};
StackView.prototype.DOMClick = function(b) {};
StackView.prototype.DOMKeyDown = function(b) {
    return
};
StackView.prototype.DOMFocus = function(b) {};
StackView.prototype.GetFocusElement = function() {
    return null
};
StackView.prototype.getFocusElementForTab = function(b) {
    return null
};
StackView.prototype.postCreate = function() {
    if (this.mStackViewType == "accordion") {
        var d = null;
        if (this.mInitPageID != null) {
            d = getFields_NS(this.windowID)[this.mInitPageID]
        }
        if (d == null || !d.IsVisible()) {
            if (this.mVisibleChildren.length > 0) {
                d = this.mVisibleChildren[0].mPageField
            }
        }
        for (var b = 0; b < this.mChildren.length; b++) {
            this.mChildren[b].mPageField.changeSize(this.mAccordionSize);
            if (this.mChildren[b].mVisible) {
                if (this.mChildren[b].mPageField == d) {
                    this.mChildren[b].mPageField.expand(false, true);
                    continue
                }
            }
            this.mChildren[b].mPageField.collapse(false, true)
        }
    } else {
        if (this.mStackViewType == "fixed") {
            for (var b = 0; b < this.mChildren.length; b++) {
                if (this.mChildren[b].mPageField.mState == 0) {
                    this.mChildren[b].mPageField.collapse(false, true)
                }
            }
        }
    }
    this.mPostCreate = true
};
StackView.prototype.registerPageField = function(b) {
    if (this.mPostCreate) {
        return
    }
    var d = this.mChildren[this.mLength++];
    d.mPageField = b;
    d.mHeader = (b.mHeader != null);
    if (this.mOrientation == "horizontal" && b.mSpan != null) {
        b.SetExpand("&#9658");
        b.SetCollapse("&#9660")
    }
};
StackView.prototype.GetNextVisiblePageField = function(g) {
    var b = null;
    for (var f = (g + 1); f < this.mChildren.length; f++) {
        if (this.mChildren[f] && this.mChildren[f].mVisible == true) {
            b = this.mChildren[f].mPageField;
            break
        }
    }
    if (!b) {
        for (var d = 0; d < g; d++) {
            if (this.mChildren[d] && this.mChildren[d].mVisible == true) {
                b = this.mChildren[d].mPageField;
                break
            }
        }
    }
    return b
};
StackView.prototype.HandleAccordionState = function(b, d) {
    if (b.getState() != d) {
        if (d == 1) {
            this.HandleAccordionClick(b, true)
        }
    }
};
StackView.prototype.HandleAccordionClick = function(f, b) {
    if (!f.IsVisible()) {
        return
    }
    var g = f.getState();
    if (g == 0) {
        for (var d = 0; d < this.mChildren.length; d++) {
            if (this.mChildren[d].mPageField == f) {
                continue
            }
            if (this.mChildren[d].mPageField.mState == 0) {
                continue
            }
            this.mChildren[d].mPageField.collapse(true, false);
            break
        }
        if (b == true) {
            this.calcAccordionPaneSize();
            f.changeSize(this.mAccordionSize)
        }
        f.expand(true, false)
    }
};
StackView.prototype.HeaderClick = function(b, d) {
    var f = b.element;
    if (this.mStackViewType == "accordion") {
        this.HandleAccordionClick(d, true)
    } else {
        if (this.mStackViewType == "fixed") {
            if ((f.tagName == "SPAN" && f.className.indexOf("Twisty") != -1) || f.tagName == "A") {
                d.toggleState()
            }
        }
    }
};
StackView.prototype.IsPageVisible = function(b) {
    return (b.mObj.getAttribute("arvisibility") == "visible")
};
StackView.prototype.SelectTab = function(b) {};
StackView.prototype.ExpandNextAccordionPage = function(g) {
    var f = null;
    for (var d = (g + 1); d < this.mChildren.length; d++) {
        if (this.mChildren[d] && this.mChildren[d].mVisible == true) {
            f = this.mChildren[d].mPageField;
            break
        }
    }
    if (!f) {
        for (var b = 0; b < g; b++) {
            if (this.mChildren[b] && this.mChildren[b].mVisible == true) {
                f = this.mChildren[b].mPageField;
                break
            }
        }
    }
    if (f) {
        if (this.mStackViewType && this.mStackViewType == "accordion") {
            this.calcAccordionPaneSize();
            f.size = this.mAccordionSize
        }
        this.HandleAccordionClick(f, false)
    }
};
StackView.prototype.GetPagePos = function(d) {
    for (var b = 0; b < this.mChildren.length; b++) {
        if (this.mChildren[b].mPageField == d) {
            return b
        }
    }
    return - 1
};
StackView.prototype.UpdatePageVis = function(h, g) {
    for (var d = 0; d < this.mChildren.length; d++) {
        if (this.mChildren[d].mPageField == g) {
            this.mChildren[d].mVisible = h ? true: false;
            g.mObj.style.visibility = h ? "inherit": "hidden";
            AsyncField_IncrAsyncRef(this.windowID, g.mID, ((h) ? -1 : 1));
            if (this.mStackViewType == "accordion") {
                if (!h && g.mState == 1) {
                    this.ExpandNextAccordionPage(d)
                } else {
                    if (h && g.mState == 0) {
                        var f = true;
                        for (var b = 0; b < this.mChildren.length; b++) {
                            if (this.mChildren[b].mPageField == g) {
                                continue
                            }
                            if (this.mChildren[b].mPageField.mState == 1 && this.mChildren[b].mVisible) {
                                f = false;
                                break
                            }
                        }
                        if (f) {
                            this.HandleAccordionClick(g, true)
                        }
                    }
                }
            }
            g.mObj.style.display = h ? "block": "none"
        }
    }
    if (this.mParentObj) {
        this.mParentObj.mAsyncDirty = (1 > this.mParentObj.mAsyncDirty ? 1 : this.mParentObj.mAsyncDirty)
    }
};
StackView.prototype.HandleState = function(b, d) {
    if (this.mStackViewType != "resizable") {
        if (this.mStackViewType == "accordion") {
            this.HandleAccordionState(b, d)
        } else {
            if (d == 0) {
                b.collapse(true, false)
            } else {
                b.expand(true, false)
            }
        }
    }
};
DPageHolder.prototype = new AsyncField();
DPageHolder.prototype.constructor = DPageHolder;
DPageHolder.superclass = AsyncField.prototype;
DOMFieldFactories.PageHolder = function(b, f, d) {
    return new DPageHolder(b, f, d)
};
function DPageHolder(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DPageHolder.prototype.mDOMField = DPageHolder.prototype.mHaveVisualCharacteristics = true;
DPageHolder.prototype.init = function(d, h, g) {
    this.mFloat = g.getAttribute("arfloattype");
    DPageHolder.superclass.init.call(this, d, h, g);
    this.mAsyncResizePending = null;
    var f = this.mObj;
    var b = f.getAttribute("arphviewtype");
    if (b == null) {
        b = "TabView"
    }
    this.mViewTypeObj = PageHolderFactories[b](this)
};
function PageHolder_DragHandler(f) {
    var b = f.srcElement.getAttribute("arpageholderid");
    var d = f.srcElement.getAttribute("arwindowid");
    getFields_NS(d)[b].DragHandler(f)
}
DPageHolder.prototype.DragHandler = function(b) {
    this.mViewTypeObj.DragHandler(b)
};
DPageHolder.prototype.DOMMouseOver = function(b) {
    hoverState.eventMouseOver(b)
};
DPageHolder.prototype.DOMMouseMove = function(b) {
    hoverState.eventMouseMove(b)
};
DPageHolder.prototype.DOMMouseOut = function(b) {
    hoverState.eventMouseOut(b)
};
DPageHolder.prototype.SelectTab = function(b) {
    this.mViewTypeObj.SelectTab(b)
};
DPageHolder.prototype.FlushAsyncQueue = function() {
    if (!this.mAsyncDirty) {
        return
    }
    if (this.mAsyncResizePending) {
        this.Resize(this.mAsyncResizePending.w, this.mAsyncResizePending.h)
    }
    this.mAsyncResizePending = null;
    this.DoLayout()
};
DPageHolder.prototype.DoLayout = function() {
    this.mViewTypeObj.DoLayout();
    if (this.mFloat == 1) {
        this.mObj.style.zIndex = nextZIndex++
    }
    this.mUIInstantiated = true
};
DPageHolder.prototype.UpdateVis = function(d) {
    var b = (this.mObj.style.visibility != "hidden");
    if (!b && d) {
        if (this.mFloat != 2) {
            this.SetAsync( - 1)
        }
        this.mObj.style.visibility = "inherit";
        if (this.mFloat == 2 || this.mFloat == 3) {
            this.mObj.style.display = "block"
        }
    } else {
        if (b && !d) {
            if (this.mFloat != 2) {
                this.SetAsync(1)
            }
            if (this.mFloat != 2) {
                this.mObj.style.visibility = "hidden"
            } else {
                if (typeof AnimMgr != "undefined") {
                    this.mHg = parseInt(this.mObj.style.height);
                    this.mWd = parseInt(this.mObj.style.width);
                    AnimMgr.shrinkFloatingPanel(this.windowID, this.mID, this.mObj, this.mHg, this.mWd, false, this)
                } else {
                    this.mObj.style.visibility = "hidden";
                    this.mObj.style.display = "none"
                }
            }
        }
    }
};
DPageHolder.prototype.UpdatePageVis = function(d, b) {
    this.mViewTypeObj.UpdatePageVis(d, b)
};
DPageHolder.prototype.G = function() {
    return this.mViewTypeObj.G()
};
DPageHolder.prototype.DoSet = DPageHolder.prototype.DoSLoadEntry = function(b) {
    this.mViewTypeObj.DoSet(b)
};
DPageHolder.prototype.TabableElementSelector = function(b) {
    return this.mViewTypeObj.TabableElementSelector(b)
};
DPageHolder.prototype.GetTabForID = function(b) {
    return this.mViewTypeObj.GetTabForID(b)
};
DPageHolder.prototype.GetTextElement = function(b) {
    return this.mViewTypeObj.GetTextElement(b)
};
DPageHolder.prototype.GetTabIndexForID = function(b) {
    return this.mViewTypeObj.GetTabIndexForID(b)
};
DPageHolder.prototype.GetFocusElementForEvent = function(b) {
    return this.mViewTypeObj.GetFocusElementForEvent(b)
};
DPageHolder.prototype.DOMClick = function(b) {
    this.mViewTypeObj.DOMClick(b)
};
DPageHolder.prototype.DOMKeyDown = function(b) {
    return this.mViewTypeObj.DOMKeyDown(b)
};
DPageHolder.prototype.DOMFocus = function(b) {
    return this.mViewTypeObj.DOMFocus(b)
};
DPageHolder.prototype.DOMBlur = function(b) {};
DPageHolder.prototype.GetFocusElement = function() {
    return this.mViewTypeObj.GetFocusElement()
};
DPageHolder.prototype.getFocusElementForTab = function(b) {
    return this.mViewTypeObj.getFocusElementForTab(b)
};
DPageHolder.prototype.registerPageField = function(b) {
    this.mViewTypeObj.registerPageField(b)
};
DPageHolder.prototype.HeaderClick = function(b, d) {
    this.mViewTypeObj.HeaderClick(b, d)
};
DPageHolder.prototype.IsPageVisible = function(b) {
    return this.mViewTypeObj.IsPageVisible(b)
};
DPageHolder.prototype.HandleState = function(b, d) {
    this.mViewTypeObj.HandleState(b, d)
};
DPageHolder.prototype.Resize = function(d, b) {
    this.mObj.style.width = d;
    if (this.mContainerID == 0 || this.mObj.style.height != "auto") {
        this.mObj.style.height = b
    }
    this.mViewTypeObj.ResizeChildren(true)
};
DPageHolder.prototype.ResizeTo = function(f, b) {
    if (this.mFloat == 2) {
        this.Resize(f, b)
    } else {
        var d = Math.round(b * (this.perHeight / 100));
        var g = f;
        if (g < this.mMinWidth) {
            g = this.mMinWidth
        } else {
            if (g > this.mMaxWidth) {
                g = this.mMaxWidth
            }
        }
        if (d < this.mMinHeight) {
            d = this.mMinHeight
        } else {
            if (d > this.mMaxHeight) {
                d = this.mMaxHeight
            }
        }
        if (this.mAsyncMode) {
            this.mAsyncResizePending = {
                w: g,
                h: d
            };
            this.mAsyncDirty = (1 > this.mAsyncDirty ? 1 : this.mAsyncDirty)
        } else {
            this.Resize(g, d)
        }
    }
};
DPageHolder.prototype.Clear = function() {};
DPageHolder.prototype.mHaveStoredData = false;
DPageHolder.prototype.MouseSelectable = false;
DPageHolder.prototype.mContainFields = true;
DPageHolder.prototype.getNoDragDropStyleClasses = function() {
    return ["PageHolderSplitterH", "PageHolderSplitterV"]
};
DPage.prototype = new Field();
DPage.prototype.constructor = DPage;
DPage.superclass = Field.prototype;
DOMFieldFactories.Page = function(b, f, d) {
    return new DPage(b, f, d)
};
function DPage(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DPage.prototype.mDOMField = DPage.prototype.mHaveVisualCharacteristics = true;
DPage.prototype.init = function(q, g, o) {
    this.mFloat = o.getAttribute("arfloattype");
    DPage.superclass.init.call(this, q, g, o);
    var C = 0;
    this.mFieldSetNode = this.mPageBody = o;
    this.mHeader = null;
    this.mBackgroundIMG = null;
    this.mResizeOnExpand = false;
    this.mSpan = null;
    this.mExpand = null;
    this.mAnchor = null;
    this.mCollapse = null;
    this.mScrollHeight = 0;
    resizeWindow = false;
    this.mPageScroll = null;
    this.mDisabled = false;
    this.mDisabledObj = null;
    this.mFit = ((o.getAttribute("arwhitespace") == 1) ? true: false);
    if (o.tagName == "DIV" || o.tagName == "FIELDSET") {
        this.getPaneAttributes();
        if ((o.className.indexOf("Panel") != -1) && (o.className.substr(0, 5) == "Panel")) {
            this.mPageScroll = o;
            getFlashURL(o, this.mID);
            for (var B = o.firstChild; B; B = B.nextSibling) {
                if (B.tagName == "FIELDSET") {
                    this.mPageBody = B;
                    break
                }
            }
            if (this.mFit) {
                var C = this.getScrollheight();
                if (C > 0) {
                    var y = F(q, this.mID);
                    var h = y.GetParent();
                    while (h) {
                        if (h instanceof DPage && h.mFillModel && h.mState == 1) {
                            h.setDirty(C)
                        }
                        h = h.GetParent()
                    }
                }
            }
        } else {
            for (var b = o.firstChild; b; b = b.nextSibling) {
                if (b.nodeType == 1) {
                    if (((b.tagName == "DIV") && b.className.indexOf("PageBody") != -1) || b.tagName == "FIELDSET") {
                        getFlashURL(b, this.mID);
                        this.mFieldSetNode = b;
                        for (var B = b.firstChild; B; B = B.nextSibling) {
                            if (B.tagName == "DIV" && B.className.indexOf("PageBody") != -1) {
                                this.mPageBody = B;
                                break
                            }
                        }
                        var A = b.getElementsByTagName("div");
                        if (A.length > 0) {
                            var k = A[0];
                            if ((typeof k.className == "string") && k.className.indexOf("FormContainerBackground") != -1) {
                                var w = k.getElementsByTagName("IMG");
                                for (var u = 0; u < w.length; u++) {
                                    if (w[u].className == "FormContainerImage") {
                                        this.mBackgroundIMG = w[u];
                                        break
                                    }
                                }
                            }
                        }
                    } else {
                        if (b.className.indexOf("PageHeader") != -1) {
                            if (b.className.indexOf("PageHeaderHorizontal") != -1) {
                                var E = getLabelforHeaders(b);
                                if (b.getAttribute("argcolor") != null) {
                                    var d = getGradientforHeader(b, "argcolor")
                                } else {
                                    var d = getGradientforHeader(b, "arcolor")
                                }
                                d += E;
                                getFlashObject(b, d, this.mID)
                            } else {
                                if (b.getAttribute("argcolor") != null) {
                                    var d = getGradientforHeader(b, "argcolor");
                                    getFlashObject(b, d, this.mID)
                                }
                            }
                            this.mHeader = b;
                            this.mSpan = b.getElementsByTagName("SPAN")[0];
                            this.mAnchor = b.getElementsByTagName("A")[0];
                            if (this.mSpan) {
                                this.mExpand = "&#9660";
                                this.mCollapse = "&#9658"
                            }
                        }
                    }
                }
            }
        }
    }
    var v = null;
    var s = o.parentNode;
    while (s && (s != getFormElements_NS(q)["FormContainer"] && s != document.body)) {
        v = s.getAttribute("arid");
        if (v != null) {
            break
        }
        s = s.parentNode
    }
    if (v && (F(q, v) instanceof DPageHolder)) {
        this.mParentObj = F(q, parseInt(v));
        this.mParentObj.registerPageField(this);
        if (this.mParentObj.GetTabForID(this.mID) != null) {
            this.mTextElement = this.mParentObj.GetTextElement(this.mID)
        }
    } else {
        this.mTextElement = this.mObj.getElementsByTagName("legend")[0]
    }
    if (this.mParentObj && this.mParentObj.mViewTypeObj.mStackViewType && this.mParentObj.mViewTypeObj.mStackViewType == "accordion") {
        this.mState = 0
    } else {
        this.mState = 1;
        if (this.mObj.getAttribute("arstate") == "0") {
            this.mState = 0
        }
    }
    var D = this.mObj.getAttribute("arfillstyle");
    if (D != null && (D == "1" || D == "2")) {
        this.mFillModel = new FillLayoutPolicy();
        getLayoutParentFields_NS(q).push(this)
    } else {
        if (this.mPageBody.className.indexOf("PageBody") != -1) {
            this.mPageBody.style.height = "100%"
        }
    }
    if (this.mPageScroll == null) {
        this.mPageScroll = this.mPageBody
    }
    if (this.mPageScroll != null) {
        this.mPageScroll.onscroll = FormEvent.Trampoline(function(f) {
            if (rtfEditor != null && rtfEditor.mEditing != null) {
                rtfEditor.UpdatePos()
            }
        })
    }
};
DPage.prototype.SetExpand = function(b) {
    this.mExpand = b
};
DPage.prototype.SetCollapse = function(b) {
    this.mCollapse = b
};
DPage.prototype.DOMMouseOver = function(b) {
    return hoverState.eventMouseOver(b)
};
DPage.prototype.DOMMouseMove = function(b) {
    return hoverState.eventMouseMove(b)
};
DPage.prototype.DOMMouseOut = function(b) {
    return hoverState.eventMouseOut(b)
};
DPage.prototype.isPartOfHeader = function(d) {
    var b = this.mObj;
    var f = d;
    while (f && f != this.mObj) {
        if (f.className.indexOf("PageHeader") != -1) {
            return true
        }
        f = f.parentNode
    }
    return false
};
DPage.prototype.DOMClick = function(b) {
    hoverState.clearTracking();
    var d = b.element;
    if (this.mHeader) {
        if (this.mParentObj && this.isPartOfHeader(d)) {
            this.mParentObj.HeaderClick(b, this)
        }
    }
};
DPage.prototype.SelectPageDueToFocusInChildField = function() {
    if (this.mParentObj) {
        var b = this.mParentObj.GetTabIndexForID(this.mID);
        this.mParentObj.SelectTab(b)
    }
};
DPage.prototype.UpdateFont = function(g) {
    if (this.mTextElement != null) {
        if (this.mParentObj && this.mParentObj.mViewTypeObj.mOrientation == "horizontal") {
            var k, f, b;
            if (this.mParentObj.mViewTypeObj.mStackViewType && this.mParentObj.mViewTypeObj.mStackViewType == "fixed") {
                k = this.mTextElement[1];
                f = k.parentNode;
                var h = k.getAttribute("tcolor");
                if (h != null) {
                    this.mTextElement[0].style.color = (h.charAt(0) == "#" ? h: ("#" + h))
                }
            } else {
                k = this.mTextElement;
                f = k.parentNode.parentNode
            }
            if (f.getAttribute("argcolor") != null) {
                b = getGradientforHeader(f, "argcolor")
            } else {
                b = getGradientforHeader(f, "arcolor")
            }
            k.setAttribute("tfont", g);
            b += getVerticalText(k);
            UpdateFlashAttributes(f, b)
        } else {
            if (this.mParentObj && this.mParentObj.mViewTypeObj.mStackViewType && this.mParentObj.mViewTypeObj.mStackViewType == "fixed") {
                var d = this.mTextElement;
                this.mTextElement = this.mTextElement[1]
            }
            DPage.superclass.UpdateFont.call(this, g);
            if (this.mParentObj && this.mParentObj.mViewTypeObj.mStackViewType && this.mParentObj.mViewTypeObj.mStackViewType == "fixed") {
                this.mTextElement = d
            }
        }
        if (this.mParentObj) {
            this.mParentObj.mAsyncDirty = (1 > this.mParentObj.mAsyncDirty ? 1 : this.mParentObj.mAsyncDirty)
        }
    }
};
DPage.prototype.UpdateColour = function(f) {
    if (f == null) {
        if ("c" in getDefaults_NS(this.windowID)[this.mID]) {
            f = getDefaults_NS(this.windowID)[this.mID].c
        } else {
            f = ""
        }
    }
    if (this.mTextElement != null) {
        if (this.mParentObj && this.mParentObj.mViewTypeObj.mOrientation == "horizontal") {
            if (this.mParentObj.mViewTypeObj.mStackViewType && this.mParentObj.mViewTypeObj.mStackViewType == "fixed") {
                var g = this.mTextElement[1];
                var d = g.parentNode;
                this.mTextElement[0].style.color = f
            } else {
                var g = this.mTextElement;
                var d = g.parentNode.parentNode
            }
            if (d.getAttribute("argcolor") != null) {
                var b = getGradientforHeader(d, "argcolor")
            } else {
                var b = getGradientforHeader(d, "arcolor")
            }
            g.setAttribute("tcolor", f);
            b += getVerticalText(g);
            UpdateFlashAttributes(d, b)
        } else {
            if (this.mParentObj && this.mParentObj.mViewTypeObj.mStackViewType && this.mParentObj.mViewTypeObj.mStackViewType == "fixed") {
                for (i = 0; i < this.mTextElement.length; i++) {
                    this.mTextElement[i].style.color = f
                }
            } else {
                DPage.superclass.UpdateColour.call(this, f)
            }
        }
        if (this.mParentObj) {
            this.mParentObj.mAsyncDirty = (1 > this.mParentObj.mAsyncDirty ? 1 : this.mParentObj.mAsyncDirty)
        }
    }
};
DPage.prototype.UpdateLabel = function(g) {
    if (this.mTextElement != null) {
        if (this.mParentObj && this.mParentObj.mViewTypeObj.mOrientation == "horizontal") {
            if (this.mParentObj.mViewTypeObj.mStackViewType && this.mParentObj.mViewTypeObj.mStackViewType == "fixed") {
                var h = this.mTextElement[1];
                var f = h.parentNode;
                if (h.getAttribute("tcolor") != null) {
                    this.mTextElement[0].style.color = "#" + h.getAttribute("tcolor")
                }
            } else {
                var h = this.mTextElement;
                var f = h.parentNode.parentNode
            }
            if (f.getAttribute("argcolor") != null) {
                var b = getGradientforHeader(f, "argcolor")
            } else {
                var b = getGradientforHeader(f, "arcolor")
            }
            h.setAttribute("vtext", g);
            b += getVerticalText(h);
            UpdateFlashAttributes(f, b)
        } else {
            if (this.mParentObj && this.mParentObj.mViewTypeObj.mStackViewType && this.mParentObj.mViewTypeObj.mStackViewType == "fixed") {
                var d = this.mTextElement;
                this.mTextElement = this.mTextElement[1]
            }
            DPage.superclass.UpdateLabel.call(this, g);
            if (this.mParentObj && this.mParentObj.mViewTypeObj.mStackViewType && this.mParentObj.mViewTypeObj.mStackViewType == "fixed") {
                this.mTextElement = d
            }
        }
        if (this.mParentObj) {
            this.mParentObj.mAsyncDirty = (1 > this.mParentObj.mAsyncDirty ? 1 : this.mParentObj.mAsyncDirty)
        }
    }
};
DPage.prototype.UpdateVis = function(f) {
    var b = this.mParentObj;
    if (typeof b == "undefined") {
        var d = (this.mObj.style.visibility != "hidden");
        if (this.mFloat != 2) {
            this.mObj.style.visibility = (f ? "inherit": "hidden")
        } else {
            if (f) {
                this.mObj.style.visibility = "inherit";
                this.mObj.style.display = "block"
            } else {
                if (typeof AnimMgr != "undefined") {
                    this.mHg = parseInt(this.mObj.style.height);
                    this.mWd = parseInt(this.mObj.style.width);
                    AnimMgr.shrinkFloatingPanel(this.windowID, this.mID, this.mObj, this.mHg, this.mWd, true)
                } else {
                    this.mObj.style.visibility = "hidden";
                    this.mObj.style.display = "none";
                    if (d && !f) {
                        AsyncField_IncrAsyncRef(this.windowID, this.mID, 1)
                    }
                }
            }
        }
        if (!d && f) {
            AsyncField_IncrAsyncRef(this.windowID, this.mID, -1);
            if (this.mFloat == 1) {
                this.mObj.style.zIndex = nextZIndex++
            }
        } else {
            if (d && !f && (this.mFloat != 2)) {
                AsyncField_IncrAsyncRef(this.windowID, this.mID, 1)
            }
        }
    } else {
        this.mObj.setAttribute("arvisibility", f ? "visible": "hidden");
        b.UpdatePageVis(f, this)
    }
};
DPage.prototype.ResizeTo = function(g, b) {
    var d = this.perWidth + "%";
    var f = this.perHeight + "%";
    if (this.mFloat == 2) {
        this.mObj.style.width = g;
        this.mObj.style.height = b
    } else {
        if (this.mObj.style.width != d) {
            this.mObj.style.width = d
        }
        if (this.mObj.style.height != f) {
            this.mObj.style.height = f
        }
    }
    this.ResizeChildren()
};
DPage.prototype.afterExpand = function(b) {
    if (b) {
        if (this.mParentObj.mViewTypeObj.mStackViewType == "fixed") {
            this.mParentObj.mViewTypeObj.applyFixedLayout()
        }
    }
    if (this.mResizeOnExpand == true) {
        this.ResizeChildren()
    }
    this.mResizeOnExpand = false
};
DPage.prototype.ResizeChildren = function() {
    var d = this.mFieldSetNode.offsetWidth;
    var f = this.mFieldSetNode.offsetHeight;
    if (f == 0) {
        f = parseInt(this.mObj.style.height)
    }
    if (d == 1) {
        d = this.size
    }
    if (f == 1) {
        f = this.size
    }
    this.AdjustBackgroundImage(d, f);
    if (this.mFillModel) {
        if (this.mState == 1) {
            var k = 0;
            var b = this.mFieldSetNode.getAttribute("arbwidth");
            if (b) {
                var g = b.split(",");
                if (g.length == 1) {
                    k = parseInt(g[0]) * 2
                } else {
                    if (this.mParentObj && this.mParentObj.mViewTypeObj.mOrientation == "vertical") {
                        k = parseInt(g[0]) + parseInt(g[2])
                    } else {
                        k = parseInt(g[1]) + parseInt(g[3])
                    }
                }
            }
            this.mFillModel.ReCalculateNewLayout(((d - k) < 0) ? 0 : d - k, ((f - k) < 0) ? 0 : f - k)
        } else {
            this.mResizeOnExpand = true
        }
    }
};
DPage.prototype.GetFocusElementForEvent = function(b) {
    var f = b.element;
    if (this.mHeader) {
        if (this.isPartOfHeader(f)) {
            for (var d = f; d != this.mObj; d = d.parentNode) {
                if (d.tagName == "A" && d.parentNode.className.indexOf("PageHeader") != -1) {
                    return f
                }
            }
            return null
        }
    }
    if (this.mParentObj) {
        return this.mParentObj.GetFocusElementForEvent(b)
    }
};
DPage.prototype.TabableElementSelector = function(b) {
    if (this.mHeader) {
        if (this.mParentObj && this.isPartOfHeader(b) && b.tagName == "A") {
            return b
        }
    }
    return null
};
DPage.prototype.DOMFocus = function(b) {
    var d = b.element;
    if (this.mHeader && d != null) {
        if (this.mParentObj && this.isPartOfHeader(d)) {
            if (FocusMgr.mCurFocusElement != this.mHeader && FocusMgr.mCurFocusElement != this.mSpan && FocusMgr.mCurFocusElement != this.mAnchor) {
                FocusMgr.mCurFocusElement = null
            }
            return DPage.superclass.DOMFocus.call(this, b)
        }
    }
    if (this.mParentObj) {
        return {
            c: {
                t: this.mParentObj,
                f: this.mParentObj.DOMFocus,
                a: [b]
            }
        }
    }
};
DPage.prototype.G = function() {
    return new IntegerType(this.getState())
};
DPage.prototype.Clear = function() {};
DPage.prototype.GetFocusElement = function() {
    if (this.mParentObj) {
        if (this.mAnchor) {
            return this.mAnchor
        }
        return this.mParentObj.getFocusElementForTab(this.mID)
    } else {
        return this.mObj
    }
};
DPage.prototype.changeSize = function(d) {
    var b = this.mParentObj.mViewTypeObj;
    this.size = (this.mHeader) ? (d - 20) : d;
    if (this.size < 0) {
        return
    }
    if (b && b.mOrientation == "vertical") {
        if (this.mFieldSetNode.style.height == "auto") {
            return
        }
        this.mFieldSetNode.style.height = this.size
    } else {
        this.mFieldSetNode.style.width = this.size
    }
    this.processChildren()
};
DPage.prototype.processChildren = function() {
    if (resizeWindow) {
        var b = this;
        setTimeout(function() {
            b.ResizeChildren()
        },
        0)
    } else {
        this.ResizeChildren()
    }
};
DPage.prototype.getState = function() {
    return this.mState
};
DPage.prototype.toggleState = function() {
    if (this.mState == 1) {
        this.collapse(true, false)
    } else {
        this.expand(true, false)
    }
};
DPage.prototype.SState = function(b) {
    if (this.mParentObj) {
        return this.mParentObj.HandleState(this, b)
    }
    return null
};
DPage.prototype.expand = function(d, k) {
    if (this.mState == 1 && (k == false)) {
        return
    }
    var h = this.mState;
    this.mState = 1;
    this.mFieldSetNode.style.display = "";
    var b = this.mParentObj.mViewTypeObj;
    if (typeof AnimMgr != "undefined" && !(b.mStackViewType == "accordion" && b.mOrientation == "horizontal")) {
        if (b.mOrientation == "vertical") {
            AnimMgr.WipeInPanel(this.mFieldSetNode, 1, this.size, this)
        } else {
            AnimMgr.WipeInPanel(this.mFieldSetNode, 0, this.size, this)
        }
    } else {
        this.afterExpand(false)
    }
    if (this.mSpan && this.mSpan.className.indexOf("Twisty") != -1) {
        this.mSpan.innerHTML = "";
        var f;
        if (this.mParentObj && this.mParentObj.mViewTypeObj.mOrientation == "horizontal") {
            f = "\u25BA"
        } else {
            f = "\u25BC"
        }
        var g = document.createTextNode(f);
        this.mSpan.appendChild(g)
    }
    if (h == 0) {
        AsyncField_IncrAsyncRef(this.windowID, this.mID, -1)
    }
    if (b != null && b.mStackViewType == "fixed") {
        if (this.mParentObj) {
            this.mParentObj.mAsyncDirty = (1 > this.mParentObj.mAsyncDirty ? 1 : this.mParentObj.mAsyncDirty)
        }
    }
    if (d && d == true) {
        if (!getCurWFC_NS(this.windowID)) {
            promptBar.setToClear()
        }
        ExecuteWorkflow(this.windowID, 33554432, this.mID)
    }
};
DPage.prototype.collapse = function(d, h) {
    if (this.mState == 0 && h == false) {
        return
    }
    var k = this.mState;
    this.mState = 0;
    this.mFieldSetNode.style.display = "none";
    var b = this.mParentObj.mViewTypeObj;
    if (typeof AnimMgr != "undefined" && !(b.mStackViewType == "accordion" && b.mOrientation == "horizontal")) {
        if (b.mOrientation == "vertical") {
            this.size = (this.mFieldSetNode.offsetHeight == 0) ? parseInt(this.mFieldSetNode.style.height) : this.mFieldSetNode.offsetHeight;
            AnimMgr.WipeOutPanel(this.mFieldSetNode, 1, this)
        } else {
            this.size = (this.mFieldSetNode.offsetWidth == 0) ? parseInt(this.mFieldSetNode.style.width) : this.mFieldSetNode.offsetWidth;
            AnimMgr.WipeOutPanel(this.mFieldSetNode, 0, this)
        }
    } else {
        this.size = (this.mParentObj.mViewTypeObj.mOrientation == "vertical") ? this.mFieldSetNode.offsetHeight: this.mFieldSetNode.offsetWidth;
        if (this.size == 0) {
            this.size = (this.mParentObj.mViewTypeObj.mOrientation == "vertical") ? parseInt(this.mFieldSetNode.style.height) : parseInt(this.mFieldSetNode.style.width)
        }
    }
    if (this.mSpan && this.mSpan.className.indexOf("Twisty") != -1) {
        this.mSpan.innerHTML = "";
        var f;
        if (this.mParentObj && this.mParentObj.mViewTypeObj.mOrientation == "horizontal") {
            f = "\u25BC"
        } else {
            f = "\u25BA"
        }
        var g = document.createTextNode(f);
        this.mSpan.appendChild(g)
    }
    if (k == 1) {
        AsyncField_IncrAsyncRef(this.windowID, this.mID, 1)
    }
    if (b != null && b.mStackViewType == "fixed") {
        if (this.mParentObj) {
            this.mParentObj.mAsyncDirty = (1 > this.mParentObj.mAsyncDirty ? 1 : this.mParentObj.mAsyncDirty)
        }
    }
    if (d && d == true) {
        if (!getCurWFC_NS(this.windowID)) {
            promptBar.setToClear()
        }
        ExecuteWorkflow(this.windowID, 67108864, this.mID)
    }
};
DPage.prototype.IsVisible = function() {
    if (this.mParentObj) {
        return this.mParentObj.IsPageVisible(this)
    } else {
        return this.mObj.style.visibility != "hidden"
    }
};
DPage.prototype.AdjustBackgroundImage = function(d, y) {
    var f = this.mBackgroundIMG;
    if (f != null) {
        var b = f.parentNode;
        var u = b.getAttribute("a");
        var k = b.getAttribute("j");
        if (typeof u != "undefined") {
            if (u == 2) {
                f.style.top = (y - f.height) / 2
            } else {
                if (u == 5) {
                    var q = b.getElementsByTagName("IMG");
                    var s = f.offsetHeight;
                    var A = s * q.length;
                    while (y > A) {
                        var o = this.createIMG(f);
                        o.style.left = 0;
                        o.style.top = A;
                        b.appendChild(o);
                        A += s
                    }
                }
            }
        }
        if (typeof k != "undefined") {
            if (k == 2) {
                f.style.left = (d - f.width) / 2
            } else {
                if (k == 5) {
                    var q = b.getElementsByTagName("IMG");
                    var v = f.offsetWidth;
                    var g = v * q.length;
                    while (d > g) {
                        var o = this.createIMG(f);
                        o.style.left = g;
                        o.style.top = 0;
                        b.appendChild(o);
                        g += v
                    }
                }
            }
        }
    }
};
DPage.prototype.createIMG = function(b) {
    var d = document.createElement("IMG");
    d.style.width = b.style.width;
    d.style.height = b.style.height;
    d.src = b.src;
    d.galleryimg = "no";
    d.className = "FormContainerImage";
    d.alt = "";
    return d
};
DPage.prototype.mHaveStoredData = false;
DPage.prototype.mContainFields = true;
DPage.prototype.getChildScroll = function(f) {
    var d = 0;
    if (this.mParentObj != null) {
        var b = this.mParentObj.mViewTypeObj;
        if (b != null && b.mOrientation == "vertical") {
            d = f.getScrollheight()
        } else {
            if (b != null && b.mOrientation == "horizontal") {
                d = f.getScrollwidth()
            }
        }
        if (d > 0) {
            this.setDirty(d)
        }
    }
};
DPage.prototype.setDirty = function(d) {
    if (this.mParentObj) {
        var b = this.mParentObj.mViewTypeObj;
        if (b != null && (b.mStackViewType == "fixed" || b.mStackViewType == "resizable")) {
            if ((this.mFillModel) && (this.mState == 1)) {
                for (var f = 0; f < b.mChildren.length; f++) {
                    if (b.mChildren[f].mPageField != null && (this.mID == b.mChildren[f].mPageField.mID)) {
                        if (b.mChildren[f].mWhitespace == true && b.mChildren[f].mVisible == true) {
                            d += 3;
                            if (b.mStackViewType == "fixed") {
                                this.mScrollHeight = d
                            }
                            PageDirty = true
                        }
                    }
                }
            }
        }
        if (PageDirty && !b.mDraw) {
            if (getCurWFC_NS(this.windowID) != null) {
                getCurWFC_NS(this.windowID).AddCallback(b, b.DoLayout, [])
            } else {
                new WorkflowContext(this.windowID, {
                    t: b,
                    f: b.DoLayout,
                    a: []
                })
            }
        }
    }
};
DPage.prototype.getScrollheight = function() {
    var b = 0;
    var d = this.mFieldSetNode.firstChild;
    if (d.scrollHeight > d.offsetHeight) {
        b = d.scrollHeight - d.offsetHeight
    }
    return b
};
DPage.prototype.getPaneAttributes = function() {
    if (this.mParentObj) {
        var b = this.mParentObj.mViewTypeObj;
        if (b != null && (b.mStackViewType == "fixed")) {
            if ((this.mFillModel) && (this.mState == 1)) {
                for (var d = 0; d < b.mChildren.length; d++) {
                    if (b.mChildren[d].mPageField != null && (this.mID == b.mChildren[d].mPageField.mID)) {
                        this.mxSize = b.mChildren[d].mMaxSize;
                        this.mFit = b.mChildren[d].mWhitespace
                    }
                }
            }
        }
    }
};
function getFlashURL(f, d) {
    var g = f.getAttribute("aropacity");
    if ((g == null || g == "1.0" || g == "0.0") && (f.getAttribute("arradius") == null) && f.getAttribute("argcolor") == null) {
        return
    } else {
        var b = RelContextPath + "resources/swf/background.swf?";
        if (f.getAttribute("aropacity") != null) {
            b += "a=" + f.getAttribute("aropacity")
        }
        if (f.getAttribute("argcolor") != null) {
            b += "&c=" + f.getAttribute("argcolor")
        } else {
            if (f.getAttribute("arcolor") != null) {
                b += "&c=" + f.getAttribute("arcolor")
            }
        }
        if (f.getAttribute("arbcolor") != null) {
            b += "&b=" + f.getAttribute("arbcolor").substring(1)
        }
        if (f.getAttribute("arbwidth") != null) {
            b += "&t=" + f.getAttribute("arbwidth")
        }
        if (f.getAttribute("vtext") != null) {
            b += "&v=" + f.getAttribute("vtext")
        }
        if (f.getAttribute("otop") != null) {
            b += "&y=" + f.getAttribute("otop")
        }
        if (f.getAttribute("rotate") != null) {
            b += "&d=" + f.getAttribute("rotate")
        }
        if (f.getAttribute("tfont") != null) {
            b += "&f=" + f.getAttribute("tfont")
        }
        if (f.getAttribute("arradius") != null) {
            b += "&r=" + f.getAttribute("arradius")
        }
        getFlashObject(f, b, d)
    }
}
function getFlashObject(h, d, f, g, b) {
    var p = "";
    var k = d.indexOf("?");
    if (k > -1) {
        p = d.substring(k + 1);
        if (p.charAt(0) == "&") {
            p = p.substring(1)
        }
        d = d.substring(0, k)
    }
    var o = document.createElement("embed");
    o.setAttribute("src", d);
    o.setAttribute("quality", "high");
    o.className = "bkgImg";
    o.setAttribute("name", "bkgFlashImg" + f);
    o.setAttribute("type", "application/x-shockwave-flash");
    o.setAttribute("wmode", "transparent");
    o.setAttribute("FlashVars", p);
    h.appendChild(o)
}
function UpdateFlashAttributes(d, b) {
    var f = d.getElementsByTagName("EMBED");
    for (i = 0; i < f.length; i++) {
        d.removeChild(f[i])
    }
    getFlashObject(d, b)
}
function getLabelforHeaders(d) {
    var b = d.getElementsByTagName("SPAN");
    for (i = 0; i < b.length; i++) {
        if (b[i].className.indexOf("label") != -1) {
            return getVerticalText(b[i])
        }
    }
}
function getGradientforHeader(f, b) {
    var d = RelContextPath + "resources/swf/background.swf?a=1&c=" + f.getAttribute(b) + "&t=0";
    return d
}
function getVerticalText(d) {
    var b;
    if (d.getAttribute("vtext") != null) {
        b = "&v=" + d.getAttribute("vtext")
    }
    if (d.getAttribute("tcolor") != null) {
        b += "&l=0&k=" + d.getAttribute("tcolor")
    }
    if (d.getAttribute("otop") != null) {
        b += "&y=" + d.getAttribute("otop")
    }
    if (d.getAttribute("rotate") != null) {
        b += "&d=" + d.getAttribute("rotate")
    }
    if (d.getAttribute("tfont") != null) {
        b += "&f=" + d.getAttribute("tfont")
    }
    return b
}
function UpdateFlashObject(d, b) {
    var g = "";
    var f = b.indexOf("?");
    if (f > -1) {
        g = b.substring(f + 1);
        if (g.charAt(0) == "&") {
            g = g.substring(1)
        }
        b = b.substring(0, f)
    }
    var h = d.getElementsByTagName("EMBED");
    if (h.length > 0 && typeof h[0] != "undefined") {
        h[0].updateParams(g)
    }
}
JStatusHistory.prototype = new JChar();
JStatusHistory.prototype.constructor = JStatusHistory;
JStatusHistory.superclass = JChar.prototype;
function JStatusHistory(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
JStatusHistory.prototype.G = function() {
    var b = JStatusHistory.superclass.G.call(this);
    if (b.isNull) {
        return Null
    }
    return new StatusHistoryType(b)
};
JStatusHistory.prototype.mIsComplexField = true;
function arInvokeGuide(b, d, f) {
    if (typeof d != "string" || typeof f != "string") {
        return
    }
    var g = getCurWFC_NS(b);
    if (g) {
        return g.execute({
            f: ARACTCallGuide,
            a: [b, d, f, true]
        })
    } else {
        new WorkflowContext(b, {
            f: ARACTCallGuide,
            a: [b, d, f, true]
        })
    }
}
function ARACTCallGuide(k, o, s, q, d, b) {
    LogWrite("ARACTCallGuide(" + k + ", " + o + ", " + s + ", " + q + ", " + d + ", " + b + ")");
    o = ExpandServerName(k, o);
    s = ExpandGuideName(k, s);
    var w = "AREVTGuide" + s.ARToJSIdentifier();
    var A = getFormWorkflowHolder(o, getFormContext(k).formName, getFormContext(k).view);
    if (w in A) {
        var g = getCurWFC_NS(k).getGuideState();
        if (g && g.g == s) {
            return
        }
        var v = {
            g: s
        };
        var p = {
            c: {},
            n: {
                f: ARACTCallGuideCont,
                a: [k],
                e: ARACTCallGuideException,
                ea: [k]
            }
        };
        if (d) {
            var y = F(k, d);
            if (y instanceof DTable) {
                v.table = y;
                v.row = 0;
                v.oldrow = y.GetRow();
                v.selected = b ? y.GetSelectedRows() : null;
                v.func = A[w];
                p.c.f = ARACTRunLoopGuide;
                p.c.a = [k];
                p.c.t = A
            } else {
                return
            }
        } else {
            p.c.f = A[w];
            p.c.a = [k];
            p.c.t = A
        }
        getCurWFC_NS(k).enterGuide(v);
        return p
    } else {
        var u = new NDXGetGuideServerAndForm(k, o, s);
        var f = u.GetResult();
        if (f.server == ARKWGetStringByIdx(k, 7) && f.form == ARKWGetStringByIdx(k, 6)) {
            var h = getLocalizedMessage(9371, [s]);
            throw new WorkflowException(k, 0, [{
                t: 2,
                n: 9371,
                m: h,
                a: null
            }])
        }
        return OpenNonModalForm(k, false, f.server, f.form, f.view, {
            wMode: 2,
            runGuide: {
                server: o,
                guidename: s,
                hidden: q,
                tableid: d,
                selectedonly: b
            }
        })
    }
}
function ARACTCallGuideException(d, b) {
    if (typeof d != "object" || !(d instanceof WorkflowException)) {
        throw d
    }
    ARACTCallGuideCont(b);
    switch (d.mCode) {
    case 3:
        return;
    case 4:
        if (getCurWFC_NS(b).getGuideState() == null) {
            return
        }
    default:
        throw d
    }
}
function ARACTCallGuideCont(d) {
    var g = getCurWFC_NS(d);
    var f = g.getGuideState();
    if (f.table) {
        if (f.oldrow >= f.table.GetData().length) {
            f.oldrow = -1
        }
        f.table.SetRow(f.oldrow);
        if (f.oldrow >= 0) {
            var b = f.table.TagFromRowNo(f.oldrow);
            f.table.mRowSelections[b] = true;
            f.table.mPrimaryRowSelection = b
        } else {
            f.table.mRowSelections = [];
            f.table.mPrimaryRowSelection = null
        }
    }
    g.exitGuide();
    if (f && f.g) {
        LogWrite("Exiting Guide : " + f.g)
    }
}
function ARACTRunLoopGuide(b) {
    var h = getCurWFC_NS(b);
    var d = h.getGuideState();
    var g = getFormWorkflowHolder(getFormContext(b).server, getFormContext(b).formName, getFormContext(b).view);
    if (d.selected != null) {
        while (d.selected[d.row] < d.table.GetRows()) {
            LogWrite("LoopGuide: selrow " + d.selected[d.row] + "/" + d.selected.length + "/" + d.table.GetRows());
            d.currow = d.selected[d.row];
            d.table.SetRow(d.currow); ++d.row;
            var f = h.execute({
                t: g,
                f: d.func,
                a: [b]
            });
            if (f) {
                return {
                    i: 1,
                    n: {
                        f: ARACTRunLoopGuide,
                        a: [b]
                    }
                }
            }
        }
    } else {
        while (d.row < d.table.GetRows()) {
            LogWrite("LoopGuide: row " + d.row + "/" + d.table.GetRows());
            d.currow = d.row;
            d.table.SetRow(d.currow); ++d.row;
            var f = h.execute({
                t: g,
                f: d.func,
                a: [b]
            });
            if (f) {
                return {
                    i: 1,
                    n: {
                        f: ARACTRunLoopGuide,
                        a: [b]
                    }
                }
            }
        }
    }
}
function ARACTSetVisibility(g, b, d) {
    if (b == 1020 && getForm_NS(g).UseResultsListPane) {
        return
    }
    LogWrite("ARACTSetVisibility(" + b + ", " + d + ")");
    var h = F(g, b);
    h.SVis(d ? true: false);
    if (h.mFloat && h.mFloat == 2) {
        if (d) {
            formModalList.addToStack(h)
        } else {
            formModalList.removeFromStack(h)
        }
    } else {
        if (h.mFloat && h.mFloat == 3) {
            if (d) {
                formTTList.show(h)
            }
        }
    }
}
function ARACTSetAccess(f, d, b) {
    LogWrite("ARACTSetAccess(" + f + ", " + d + ", " + b + ")");
    F(f, d).SAccess(b)
}
function ARACTSetEntryMode(d, b, h, k, g) {
    LogWrite("ARACTSetEntryMode(" + d + ", " + b + ", " + h + ", " + k + ", " + g + ")");
    var f = F(d, b);
    if (f instanceof DataField) {
        if (h == 1 && (!((typeof f.mCFCache.r != "undefined") && f.mCFCache.r == 1))) {
            f.setBoldness(true);
            f.setDecorator(k, g);
            f.mCFCache.r = 1
        } else {
            if (h == 0 && (!((typeof f.mCFCache.r != "undefined") && f.mCFCache.r == 0))) {
                f.UpdateLabel(f.GLabel());
                f.setBoldness(false);
                f.RemoveHighlightBorder();
                f.mCFCache.r = 0
            }
        }
    }
}
function ARACTSetLabelColour(d, b, f) {
    LogWrite("ARACTSetLabelColour(" + d + ", " + b + ", " + f + ")");
    F(d, b).SColour(f)
}
function ARACTSetLabel(d, b, f) {
    LogWrite("ARACTSetLabel(" + d + ", " + b + ', "' + f + '")');
    f = ExpandString(d, f, 1);
    F(d, b).SLabel(f)
}
function ARACTSetFont(d, b, f) {
    LogWrite("ARACTSetFont(" + d + ", " + b + ', "' + f + '")');
    F(d, b).SFont(f)
}
function ARACTSetMenu(d, b, f) {
    LogWrite("ARACTSetMenu(" + d + ", " + b + ', "' + f + '")');
    F(d, b).SMenu(f)
}
function ARACTTableRefresh(d, b) {
    LogWrite("ARACTTableRefresh(" + d + ", " + b + ")");
    var f = F(d, b);
    if (f instanceof DTable) {
        return f.Refresh( - 1, 0, false, 0)
    }
}
function ARACTBulkTableRefresh() {
    var windowID = arguments[0];
    var args = [];
    var tableprops = [];
    for (var i = 1; i < arguments.length; i++) {
        var table = F(windowID, arguments[i]);
        if (! (table instanceof DTable)) {
            continue
        }
        var start, maxrows, oldcurrow = null;
        var refreshmode = parseInt(table.mObj.getAttribute("arselrefresh"));
        if (this.mNotRefreshed || (refreshmode != 0 && refreshmode != 1)) {
            table.ClearSelections(true)
        }
        if (table.mChunkSize > 0) {
            if (table.mResult) {
                var maxpage = Math.ceil(table.mResult.n / table.mChunkSize);
                if (table.mChunkPage >= maxpage) {
                    table.mChunkPage = maxpage - 1
                }
            }
            if (table.mChunkPage < 0) {
                table.mChunkPage = 0
            }
            start = (startrow >= 0) ? startrow: table.mChunkPage * table.mChunkSize;
            maxrows = (numrows > 0) ? numrows: table.mChunkSize
        } else {
            start = (startrow >= 0) ? startrow: 0;
            maxrows = (numrows > 0) ? numrows: parseInt(table.mObj.getAttribute("armaxrows"))
        }
        if (table.mNotRefreshed && table.mSortOrder.length == 0) {
            var sortorder = table.GetInitialRowSortOrder();
            if (sortorder != null) {
                table.RebuildSortOrder(sortorder.col, sortorder.dir)
            }
        }
        var refreshmode = parseInt(table.mObj.getAttribute("arselrefresh"));
        var server = table.mObj.getAttribute("arserver");
        server = ExpandServerName(windowID, server);
        var schema = table.mObj.getAttribute("arschema");
        schema = ExpandSchemaName(windowID, schema);
        var qual;
        if (typeof this.mQual != "undefined") {
            qual = table.mQual
        } else {
            qual = table.mObj.getAttribute("arqual");
            eval("qual=" + qual)
        }
        var optimizeCall = IsExternQualOptimizable(windowID, qual);
        qual = ExpandQualifier(windowID, qual, schema, server, optimizeCall);
        var startrow = -1,
        numrows = 0;
        var maxrows, start;
        if (table.mChunkSize > 0) {
            start = (startrow >= 0) ? startrow: table.mChunkPage * table.mChunkSize;
            maxrows = (numrows > 0) ? numrows: table.mChunkSize
        } else {
            start = (startrow >= 0) ? startrow: 0;
            maxrows = (numrows > 0) ? numrows: parseInt(table.mObj.getAttribute("armaxrows"))
        }
        var p = [start, maxrows, refreshmode];
        tableprops[arguments[i]] = p;
        var irid = table.getImgRefIds();
        var iccid = table.getCColorIds();
        args.push(MarshallArgsWrapper("GetTableEntryList", windowID, ARKWGetStringByIdx(windowID, 7), ARKWGetStringByIdx(windowID, 6), ARKWGetStringByIdx(windowID, 17), table.mID, server, schema, ((ARKWGetStringByIdx(windowID, 21) != null) ? ARKWGetStringByIdx(windowID, 21) : ""), start, maxrows, table.mSortOrder, qual.qual, qual.fieldids, qual.fieldvals, qual.fieldtypes, qual.fieldexterns, optimizeCall, irid, iccid))
    }
    if (args.length == 0) {
        return
    }
    var req = new NDXGetBulkTableEntryList(windowID, args);
    var result = eval(req.result);
    var part2 = [];
    for (var i in result) {
        var prop = tableprops[i];
        var rr = F(windowID, i).RefreshTable_part2(result[i], prop[0], prop[1], prop[2]);
        if (typeof rr != "undefined") {
            part2.push(rr)
        }
    }
    getCurWFC_NS(windowID).pushEntryForBulk(part2)
}
function MarshallArgsWrapper(v, f, w, B, d, p, g, h, k, s, A, b, q, o, u, y) {
    return MarshallArgs(arguments)
}
function ARACTExpandCollapseTreeLevels(f, b, d) {
    LogWrite("ARActExpandCollapseTreeLevels(" + f + ", " + b + ", " + d + ")");
    var g = F(f, b);
    if (g instanceof DTreeView) {
        if (d == 1) {
            g.ExpandAll()
        } else {
            if (d == 2) {
                g.CollapseAll()
            }
        }
    }
    if (g instanceof DTable && g.mGroup) {
        if (d == 1) {
            g.ExpandAll()
        } else {
            if (d == 2) {
                g.CollapseAll()
            }
        }
    }
}
function ARACTSetPageState(d, b, f) {
    LogWrite("ARActExpandCollapseTreeLevels(" + d + ", " + b + ", " + f + ")");
    var g = F(d, b);
    if (g instanceof DPage) {
        return g.SState(f)
    }
}
function ARACTSetFocus(d, b) {
    LogWrite("ARACTSetFocus(" + d + ", " + b + ")");
    return {
        n: {
            t: FocusMgr,
            f: FocusMgr.SetFocusToField,
            a: [d, b]
        }
    }
}
function ARACTIndirectChangeField(h, d, b) {
    var k = F(d, b).G().toString();
    k = k.trim(1 | 2);
    if (k.isNumeric()) {
        b = parseInt(k);
        var f = new Array(arguments.length - 1);
        f[0] = d;
        f[1] = b;
        for (var g = 2; g < arguments.length - 1; ++g) {
            f[g] = arguments[g + 1]
        }
        return h.apply(null, f)
    }
}
function ARACTSetDraggable(f, d, b) {
    LogWrite("ARACTSetDraggable(" + f + ", " + d + ", " + b + ")");
    F(f, d).SDraggable(b ? true: false)
}
function ARACTSetDroppable(d, b, f) {
    LogWrite("ARACTSetDroppable(" + d + ", " + b + ", " + f + ")");
    F(d, b).SDroppable(f ? true: false)
}
function ARACTCloseWindow(d, b) {
    LogWrite("ARACTCloseWindow(" + d + ", " + b + ")");
    return {
        c: {
            f: weDisplayWFNotes,
            a: [d, window]
        },
        n: {
            f: ARACTCloseWindowP2,
            a: [d, b]
        }
    }
}
function ARACTCloseWindowP2(d, b) {
    var g = {};
    var f = getStateMgr_NS(d);
    return {
        c: {
            t: f,
            f: f.WindowIsClosing,
            a: [g]
        },
        n: {
            f: function(o, k, h) {
                if (!k.ab) {
                    getStateMgr_NS(h).mWindowIsClosed = true;
                    if (o == 0) {
                        if (weAmDialogue(window.name)) {
                            weCloseDialogue(h, window.weDialogueReturnValue)
                        } else {
                            weCloseWindow(h, window, true)
                        }
                    } else {
                        var p = window;
                        var q = p;
                        while (q) {
                            q = p.weGetOpener();
                            if (q) {
                                if (!q.closed) {
                                    p = q
                                } else {
                                    break
                                }
                            }
                        }
                        p.weCloseAllWindows(h, p, true, null)
                    }
                    throw new WorkflowException(h, 0, [])
                }
            },
            a: [b, g, d]
        }
    }
}
function ARACTCommit(windowID) {
    LogWrite("ARACTCommit(" + windowID + ")");
    if ((getARStateCurrent_NS(windowID) == 2)) {
        try {
            var testOpener = window.weGetOpener(windowID).name
        } catch(e) {
            LogAndAlert("Cannot commit changes because the parent window has been closed.");
            return null
        }
        var weArgs = getWindowArgs_NS(windowID);
        if (weArgs != null && "fvout" in weArgs) {
            var dlgOut = new FieldList(windowID);
            var fields = getFields_NS(windowID);
            for (var item in fields) {
                var val = {
                    t: fields[item].G().type,
                    v: fields[item].G().toPrimitive()
                };
                dlgOut.AddField(item, Datatype_Factory(val))
            }
            var myOpener = window.weGetOpener(windowID);
            for (var item in weArgs.fvout) {
                if (typeof(weArgs.fvout[item]) != "function") {
                    LogWrite("Committing field " + item + " back to parent with value " + weArgs.fvout[item]);
                    var value = eval(weArgs.fvout[item]);
                    myOpener.SetFieldFromDialog(weGetDialogueParentID(), item, {
                        t: value.type,
                        v: value.toPrimitive()
                    })
                }
            }
        }
    } else {
        return FormAction_GenericApply(windowID)
    }
}
function ARACTExitGuide(d, b) {
    LogWrite("ARACTExitGuide(" + d + ", " + b + ")");
    if (ARKWGetStringByIdx(d, 20) == null) {
        return
    }
    if (b) {
        throw new WorkflowException(d, 4)
    } else {
        throw new WorkflowException(d, 3)
    }
}
function ARACTGoto(b, d) {
    if (getCurWFC_NS(b).getGuideState() != null) {
        return
    }
    LogWrite("ARACTGoto(" + b + ", " + d + ")");
    if (d < 0) {
        d = 0
    } else {
        if (d > 1000) {
            d = 1000 + 1
        }
    }
    throw new WorkflowException(b, 1, d)
}
function ARACTGotoGuideLabel(b, d) {
    LogWrite("ARACTGotoGuideLabel(" + b + ", " + d + ")");
    ARGotoGuideLabel(b, d)
}
function ARACTMessage(f, k, g, b, d) {
    var q = d;
    if (k == 7) {
        q = q.HTMLEncode()
    }
    LogWrite("Message [" + g + "] " + q);
    d = ExpandString(f, d, 1 | 2 | 4 | 8);
    q = d;
    if (k == 7) {
        q = q.HTMLEncode()
    }
    LogWrite("Expanded Message : " + q);
    var o = [{
        t: k,
        n: g,
        m: d,
        a: null
    }];
    if (k == 2 || k == 3) {
        var p = (b) ? 0 : 1;
        getCurWFC_NS(f).status(o, p)
    } else {
        if (k == 7) {
            var h = {
                n: {
                    f: ARACTToolTip,
                    a: [f, o]
                }
            }
        } else {
            var h = {
                n: {
                    f: ARACTMessageP2,
                    a: [f, o, b]
                }
            };
            if (getCurWFC_NS(f).notes.length > 0) {
                h.c = {
                    f: WC_DisplayMessage,
                    a: [f, getCurWFC_NS(f).notes]
                }
            }
        }
        return h
    }
}
function ARACTMessageP2(b, f, h) {
    getCurWFC_NS(b).notes = [];
    if (!h) {
        window.focus()
    }
    var d = (h) ? 0 : 1;
    var g = {
        mstat: f[0],
        msgloc: d
    };
    return WC_DisplayMessage(b, [g])
}
function ARACTToolTip(d, b) {
    return toolTip.showToolTip(d, b[0].m)
}
function ARACTPrompt(b, f, d, g, h) {
    h = ExpandString(b, h, 1 | 2 | 4 | 8);
    window.status = getLocalizedMessage(h, null);
    if (f == 2 || f == 3) {
        getCurWFC_NS(b).status(0)
    }
}
function continueModal(b, f) {
    var d = getCurWFC_NS(b);
    if (d) {
        d.resume()
    }
}
function ARACTOpenDialog(d, g, k, p, C, f, u, b, s, h) {
    LogWrite("ARACTOpenDialog(" + g + ", " + k + ", " + p + ", " + C + ", " + f + "," + b + "," + s + ")");
    g = ExpandServerName(d, g);
    k = ExpandGuideName(d, k);
    p = ExpandString(d, p, 1 | 2 | 4);
    var q = new NDXGetURLForForm(d, g, ((ARKWGetStringByIdx(d, 21) != null) ? ARKWGetStringByIdx(d, 21) : ""), k, p, true, "", "").GetResult();
    var y;
    if (q.dims == null) {
        y = null
    } else {
        y = q.dims.split(",");
        y[0] = parseInt(y[0]);
        y[1] = parseInt(y[1])
    }
    for (var o in f) {}
    var A = k + "(" + g + ")";
    var B = {
        cb: C,
        fvlist: f,
        fvout: u,
        title: A
    };
    if (s) {
        B.runGuide = {
            server: b,
            guidename: s,
            hidden: false
        }
    }
    if (q.url.indexOf("?") != -1) {
        q.url = q.url + "&format=html"
    } else {
        q.url = q.url + "?format=html"
    }
    var v = window.weOpenDialogue(d, q.url, "FormDialog", B, continueModal, y, h);
    if (v) {
        ARKWSet(d, 35, v.name)
    }
    return {
        i: 1
    }
}
function OpenNonModalForm(f, q, g, d, p, h) {
    if (q == 2 && weAmDialogue(window.self.name)) {
        q = 1
    }
    var o = q == 2 ? window.self.name: ("" + new Date().getTime());
    var s = g.toLowerCase() + d + o;
    var k = weDeepSerialiseVariable(h);
    var b = new NDXGetURLForForm(f, g, ((ARKWGetStringByIdx(f, 21) != null) ? ARKWGetStringByIdx(f, 21) : ""), d, p, false, s, k).GetResult().url;
    return OpenNonModalURL(f, b, q, o)
}
function OpenNonModalURL(d, g, b, f) {
    ARKWSet(d, 35, f);
    var h = allocWindowID_NS();
    if (g.indexOf("?") != -1) {
        g = g + "&format=html"
    } else {
        g = g + "?format=html"
    }
    return {
        c: {
            f: weDisplayWFNotes,
            a: [d, window]
        },
        n: {
            f: function(o) {
                if (b == 2) {
                    try {
                        o.open(g, o.name)
                    } catch(k) {}
                    o.arWindowType = "Form";
                    WorkflowContext.WindowOpened(d);
                    return o.self
                }
                if (b == 3) {
                    o.weOpen(h, d, g, f, "Form", null, null, false, false)
                } else {
                    o.weOpen(h, d, g, f, "Form", null, null, true, false)
                }
            },
            a: [window]
        }
    }
}
function arInvokeForm(b, f, d, g) {
    if (typeof f != "string" || typeof d != "string" || (typeof g != "number" && typeof g != "string")) {
        return
    }
    if (typeof g == "string") {
        g = g.toLowerCase().trim(1 | 2);
        if ("new" == g || "submit" == g) {
            g = 2
        } else {
            if ("search" == g || "query" == g) {
                g = 1
            } else {
                if ("display" == g) {
                    g = 11
                } else {
                    g = 1
                }
            }
        }
    }
    var h = getCurWFC_NS(b);
    if (h) {
        return h.execute({
            f: ARACTOpenWindow,
            a: [b, f, d, "", "Current", 0, null, g, null, null, {}]
        })
    } else {
        new WorkflowContext(b, {
            f: ARACTOpenWindow,
            a: [b, f, d, "", "Current", 0, null, g, null, null, {}]
        })
    }
}
function ARACTOpenWindow(d, g, k, q, w, v, f, h, b, s, p) {
    LogWrite("ARACTOpenWindow(" + d + ", " + g + ", " + k + ", " + q + ", " + w + ", " + f + ", " + h + "," + b + "," + s + ")");
    g = ExpandServerName(d, g);
    k = ExpandGuideName(d, k);
    if ((typeof __tmp_app == "undefined") && (g == "" || k == "")) {
        throw new WorkflowException(d, 0, [])
    }
    q = ExpandString(d, q, 1 | 2 | 4);
    var o = {
        wname: "",
        fvlist: f,
        wMode: h,
        wForceClear: 1,
        fvSetDefaults: v
    };
    if (s) {
        o.runGuide = {
            server: b,
            guidename: s,
            hidden: false
        }
    }
    w = ExpandString(d, w, 1 | 2 | 4);
    if (IsTargetLocationViewField(d, w, g, k, q, o, p)) {
        return
    }
    var u = 1;
    if (w.compareToIgnoreCase("current")) {
        u = 2
    } else {
        if (w.compareToIgnoreCase("newwithouttoolbar")) {
            u = 3
        }
    }
    return {
        c: {
            f: OpenNonModalForm,
            a: [d, u, g, k, q, o]
        },
        n: {
            f: function(B, A, y) {
                if (B == 2 && !weAmDialogue(A.self.name)) {
                    throw new WorkflowException(y, 0, [])
                }
            },
            a: [u, window, d]
        }
    }
}
function ARACTOpenQueryWindow(g, G, E, w, N, A, p, o, d, L, J, B, s, y, H, u) {
    LogWrite("ARACTOpenQueryWindow(" + g + ", " + G + ", " + E + ", " + w + ", " + N + ", " + A + ", " + p + ", " + o + ", " + d + ", " + L + J + "," + B + "," + s + "," + y + ")");
    G = ExpandServerName(g, G);
    E = ExpandGuideName(g, E);
    if (G == "" || E == "") {
        throw new WorkflowException(g, 0, [])
    }
    p = ExpandQualifier(g, p, E, G);
    w = ExpandString(g, w, 1 | 2 | 4);
    var O = ExpandString(g, N, 1 | 2 | 4);
    var q = O.compareToIgnoreCase("Current");
    var v = q ? window.self.name: ("" + new Date().getTime());
    var C = G.toLowerCase() + E + v;
    var K = 1;
    if (A == 12 || A == 13 || A == 14 || A == 15) {
        K = 0
    }
    var D = {
        wname: C,
        wMode: A,
        wForceClear: K,
        qual: p,
        sort: J,
        suppressNoMatch: o,
        noMatchMessage: d,
        interval: H
    };
    var k = weDeepSerialiseVariable(D);
    d.m = ExpandString(g, d.m, 1 | 2 | 4 | 8);
    if (s) {
        D.runGuide = {
            server: B,
            guidename: s,
            hidden: false
        }
    }
    var I = IsDestinationViewField(g, O);
    if (I) {
        b = new NDXRequest();
        b.windowID = g;
        b.SendAsync("GetOpenWindowQueryVF", g, G, E, ((ARKWGetStringByIdx(g, 21) != null) ? ARKWGetStringByIdx(g, 21) : ""), p.qual, p.fieldids, p.fieldvals, p.fieldtypes, w, C, J)
    }
    if (IsTargetLocationViewField(g, O, G, E, w, D, u)) {
        y.v = 0;
        return
    }
    var b = new NDXGetOpenWindowURL(g, G, E, ((ARKWGetStringByIdx(g, 21) != null) ? ARKWGetStringByIdx(g, 21) : ""), p.qual, p.fieldids, p.fieldvals, p.fieldtypes, L, (!o && d.t == 2), w, C, k, J);
    var P = b.result;
    if (P.n == 0 && L) {
        if (y) {
            y.v = 1
        }
        return
    }
    var h = 1;
    if (N.compareToIgnoreCase("current")) {
        h = 2
    } else {
        if (N.compareToIgnoreCase("newwithouttoolbar")) {
            h = 3
        }
    }
    return {
        c: {
            f: OpenNonModalURL,
            a: [g, P.url, h, v]
        },
        n: {
            f: function(R, S, V, Q, W, U, f) {
                if (S.n == 0 && !V && Q.t == 2) {
                    getCurWFC_NS(R).status(0, [])
                }
                if (W == "Current" && !weAmDialogue(U.self.name)) {
                    throw new WorkflowException(R, 0, [])
                }
                if (f) {
                    f.v = 0
                }
                return
            },
            a: [g, P, o, d, N, window, y]
        }
    }
}
function ARACTOpenReportWindow(d, y, w, q, G, u, k, h, E, D, p, v, o, s, A, H) {
    LogWrite("ARACTOpenReportWindow(" + d + ", " + y + ", " + w + ", " + q + ", " + G + ", " + u + ", " + k + ", " + h + ", " + E + ", " + D + ", " + p + "," + v + "," + o + "," + s + ", " + A + ", " + H + ")");
    y = ExpandServerName(d, y);
    w = ExpandGuideName(d, w);
    if (y == "" || w == "") {
        throw new WorkflowException(d, 0, [])
    }
    q = ExpandString(d, q, 1 | 2 | 4);
    G = ExpandString(d, G, 1 | 2 | 4);
    var B = "";
    if (p.dt) {
        B = ExpandString(d, p.dt, 1 | 2 | 4)
    }
    var g = B.indexOf(":");
    if (g != -1) {
        B = B.substr(0, g + 2)
    }
    if (B != "to-file: " && B != "to-screen: ") {
        B = "to-screen: "
    }
    var b = ExpandString(d, p.ty, 1 | 2 | 4);
    var C = CreateReportParms(d, y, w, q, G, u, k, h, E, D, p, s, A, H);
    var f = (G != "Current");
    if (B == "to-file: " && b == "1") {
        ReportToFile(d, C, y)
    } else {
        ReportToScreen(d, f, C, y, G)
    }
    return 0
}
function IsDestinationViewField(b, h) {
    var d = /^VF([0-9]+)$/;
    if (d.test(h)) {
        var g = F(b, h.substring(2));
        if (g instanceof DView) {
            return g
        }
    }
    return null
}
var ap = null;
function IsTargetLocationViewField(k, d, K, J, w, b, s) {
    var O = d;
    var q = k;
    var h = (typeof s == "object" && typeof s.inline != "undefined" && s.inline == true) ? true: false;
    if (O.compareToIgnoreCase("current")) {
        var H = getParentWindowID_NS(k);
        if (H != null) {
            var E = getViewFields_NS(H);
            for (var L in E) {
                if (E[L] != null && E[L].mChildWindowID != null && E[L].mChildWindowID == k) {
                    q = H;
                    d = "VF" + E[L].mID;
                    h = true;
                    break
                }
            }
        }
    }
    var N = IsDestinationViewField(q, d);
    if (N != null) {
        var A = null;
        var B = null;
        var g = null;
        var p = null;
        var D = window.frames[d];
        var I = N.mID;
        var u = true;
        if (((I == "80028") || (I == "80058") || (I == "80043") || (I == "80073")) && (N.ft)) {
            var Q = getUDDHolderById(q).vf;
            if ((typeof Q != "undefined") && (typeof Q[I] != "undefined")) {
                A = Q[I].server;
                B = Q[I].form;
                g = Q[I].view;
                u = false;
                N.ft = false;
                h = true
            }
        }
        if (!h && N.isInlineForm()) {
            N.ClearInlineFormSettings()
        }
        if (D != null && "ARProcessEvent" in D) {
            N.mObj.childNodes[1].src = "about:blank"
        }
        if (!h && u) {
            var o = weDeepSerialiseVariable(b);
            var C = K.toLowerCase() + J + N.mFrameName;
            if (typeof p == "undefined" || p == null) {
                p = new NDXGetURLForForm(q, K, ((ARKWGetStringByIdx(k, 21) != null) ? ARKWGetStringByIdx(k, 21) : ""), J, w, false, C, o).GetResult().url
            }
        }
        if (!h && u) {
            if (p.indexOf("?") != -1) {
                p = p + "&format=html"
            } else {
                p = p + "?format=html"
            }
        } else {
            if (A == null) {
                A = K
            }
            if (B == null) {
                B = J
            }
            if (g == null) {
                g = w
            }
            var y = null;
            if (g == null || g == "") {
                y = getSFVSnippetFromSF(A, B)
            } else {
                y = getSFVSnippet(A, B, g)
            }
            if (y == null) {
                y = new NDXGetHTMLScriptForViewField(q, A, ((ARKWGetStringByIdx(k, 21) != null) ? ARKWGetStringByIdx(k, 21) : ""), B, g, false).GetResult();
                if (g == null || g == "") {
                    setSFMap(A, B, y.viewname)
                }
                setSFVSnippet(A, B, y.viewname, y)
            } else {
                if (ariever6 && !u) {
                    var P = new NDXGetHTMLScriptForViewField(q, A, ((ARKWGetStringByIdx(k, 21) != null) ? ARKWGetStringByIdx(k, 21) : ""), B, g, true).GetResult();
                    y.js = P.js;
                    y.udd = P.udd;
                    u = true
                }
            }
            N.OpenInlineForm(A, B, y.viewname, y, b, u, (O == "Current"));
            if (O == "Current") {
                throw new WorkflowException(k, 0, [])
            }
        }
        if (!h && u) {
            var v = document.location;
            var G = v.protocol + "//" + v.hostname;
            if (v.port) {
                G += ":" + v.port
            }
            G += p;
            N.S(new CharType(G))
        }
        return true
    }
    return false
}
function MakeReportKey(b) {
    return "{0}/{1}".replaceArgs(b.length, b)
}
function MakeReportIntKey(b) {
    var d = b + "";
    return "{0}/{1}".replaceArgs(d.length, d)
}
function CreateReportParms(f, v, u, o, C, s, h, g, B, A, k, p, w, G) {
    var E = [];
    var q;
    var d;
    E.push((u != null) ? MakeReportKey(u) : "0/");
    E.push((v != null) ? MakeReportKey(v) : "0/");
    E.push((o != null) ? MakeReportKey(o) : "0/");
    if (k.ty) {
        d = ExpandString(f, k.ty, 1 | 2 | 4);
        E.push((d != null) ? MakeReportKey(d) : "0/")
    } else {
        E.push("0/")
    }
    if (k.na) {
        d = ExpandString(f, k.na, 1 | 2 | 4);
        E.push((d != null) ? MakeReportKey(d) : "0/")
    } else {
        E.push("0/")
    }
    if (k.op) {
        d = ExpandString(f, k.op, 1 | 2 | 4);
        E.push((d != null) ? MakeReportKey(d) : "0/")
    } else {
        E.push("0/")
    }
    if (k.id) {
        d = ExpandString(f, k.id, 1 | 2 | 4);
        E.push((d != null) ? MakeReportKey(d) : "0/")
    } else {
        E.push("0/")
    }
    if (k.or) {
        d = ExpandString(f, k.or, 1 | 2 | 4);
        E.push((d != null) ? MakeReportKey(d) : "0/")
    } else {
        E.push("0/")
    }
    if (k.dt) {
        d = ExpandString(f, k.dt, 1 | 2 | 4);
        E.push((d != null) ? MakeReportKey(d) : "0/")
    } else {
        E.push("0/")
    }
    E.push((p != null) ? MakeReportKey(p) : "0/");
    E.push((w != null) ? MakeReportIntKey(w) : "0/");
    E.push((G != null) ? MakeReportKey(G) : "0/");
    if (k.lc) {
        d = ExpandString(f, k.lc, 1 | 2 | 4);
        E.push((d != null) ? MakeReportKey(d) : "0/")
    } else {
        E.push("0/")
    }
    if (k.cs) {
        d = ExpandString(f, k.cs, 1 | 2 | 4);
        E.push((d != null) ? MakeReportKey(d) : "0/")
    } else {
        E.push("0/")
    }
    if (h != null) {
        h = ExpandQualifier(f, h, u, v);
        if (h.qual != "" && h.fieldids.length > 0) {
            var b = new NDXParseAndEvaluateQualifier(f, v, u, o, h.qual, h.fieldids, h.fieldvals, h.fieldtypes);
            h = {
                qual: b.result,
                fieldids: [],
                fieldvals: [],
                fieldtypes: []
            }
        }
        E.push((h.qual != null) ? MakeReportKey(h.qual) : "0/")
    } else {
        E.push("0/")
    }
    if (A != null && A.length > 0) {
        var y = A.join(":");
        E.push(MakeReportKey(y))
    } else {
        E.push("0/")
    }
    if (window.opener != "undefined" && window.opener != null && !window.opener.closed) {
        var D = E.slice();
        D.splice(0, 3);
        window.opener.quickReportParamURL = D.join("");
        window.opener.quickReportSchema = u
    }
    return E.join("")
}
function ReportToScreenCurrent(f, b, k) {
    var d = window.document.createElement("DIV");
    d.style.top = 0;
    d.style.left = 0;
    d.style.zIndex = 100001;
    d.style.position = "absolute";
    d.style.display = "none";
    window.document.body.appendChild(d);
    var p = '<FORM method="POST" action="{0}" enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" target="{1}"><input type=hidden name="{2}" value="{3}"/><input type=hidden name="{4}" value="{5}"/></FORM>';
    var g = (AbsContextPath + "servlet/ReportServlet") + "/" + new Date().getTime();
    var o = p.replaceArgs(g, "_parent", "REPPARM", b.HTMLEncode(), "server", k);
    d.innerHTML = o;
    var h = d.firstChild;
    h.submit();
    window.document.body.removeChild(d)
}
function genReportHTML(b, f) {
    var g = '<html><head></head><body onload=document.forms["RPTDIS70"].submit()><FORM name=RPTDIS70 id=RPTDIS702 method="POST" enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" action="{0}"><input type=hidden name="{1}" value="{2}"/><input type=hidden name="{3}" value="{4}"/></FORM></body></html>';
    var d = (AbsContextPath + "servlet/ReportServlet") + "/" + new Date().getTime();
    return g.replaceArgs(d, "REPPARM", b.HTMLEncode(), "server", f)
}
function ReportToScreenNew(f, b, o) {
    var g = "ReportWin" + new Date().getTime();
    var h = allocWindowID_NS();
    var d = window.weOpen(h, f, "", g, "Report", null, null, false, true);
    WorkflowContext.WindowOpened(f);
    d.arWindowType = "Report";
    var k = d.document;
    k.open("text/html");
    k.write(genReportHTML(b, o));
    k.close()
}
function ReportToScreen(d, g, b, h, k) {
    if (g) {
        var f = IsDestinationViewField(d, k);
        if (f != null) {
            f.S(new CharType(genReportHTML(b, h)))
        } else {
            ReportToScreenNew(d, b, h)
        }
    } else {
        ReportToScreenCurrent(d, b, h)
    }
}
function GetSaveFrameTarget(b) {
    var f = window.frames.exportSaveFrame;
    if (!f || (f == null)) {
        var d = window.document.createElement("div");
        d.innerHTML = '<IFRAME name="exportSaveFrame" onload=saveFrameLoaded(' + b + ') src="javascript:&quot;&lt;HTML&gt;&lt;/HTML&gt;&quot;"></IFRAME>';
        d.style.display = "none";
        d.style.top = d.style.left = 0;
        d.style.bottom = d.style.right = 1;
        window.document.body.appendChild(d)
    }
    return "exportSaveFrame"
}
function saveFrameLoaded(d) {
    var h = window.frames[GetSaveFrameTarget(d)];
    try {
        if (h.document && h.document.body) {
            if (h.document.location.href != "about:blank") {
                var f = h.window.Msg;
                if (!f) {
                    f = getLocalizedMessage("Failed to perform Action")
                }
                ShowAlertPopup(d, f, getLocalizedMessage("Report Error"))
            }
        }
    } catch(b) {
        var g = WorkflowContext_StatusToString(d, [b.message]);
        ShowAlertPopup(d, g, getLocalizedMessage("Report Error"))
    }
}
function ReportToFile(g, h, k) {
    var p = window.document.createElement("DIV");
    p.style.top = 0;
    p.style.left = 0;
    p.style.zIndex = 100001;
    p.style.position = "absolute";
    p.style.display = "none";
    window.document.body.appendChild(p);
    var q = '<FORM method="POST" action="{0}" enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" target="{1}"><input type=hidden name="{2}" value="{3}"/><input type=hidden name="{4}" value="{5}"/></FORM>';
    var d = (AbsContextPath + "servlet/ReportServlet") + "/" + new Date().getTime();
    var o = GetSaveFrameTarget(g);
    var b = q.replaceArgs(d, o, "REPPARM", h.HTMLEncode(), "server", k);
    p.innerHTML = b;
    var f = p.firstChild;
    f.submit();
    window.document.body.removeChild(p)
}
var ARRPValues = {
    "GET-CHANGE-FLAG": {
        t: 2,
        f: ARProcessGetChangeFlag,
        tc: []
    },
    JAVASCRIPT: {
        t: 7,
        f: ARProcessJavascript,
        tc: []
    },
    "PERFORM-ACTION-ACTIVE-LINK": {
        t: 5,
        f: ARProcessActionActiveLink,
        tc: [2, 4]
    },
    "PERFORM-ACTION-ADD-ATTACHMENT": {
        t: 7,
        f: ARProcessAddAttach,
        tc: [2, 4]
    },
    "PERFORM-ACTION-APPLY": {
        t: 5,
        f: ARProcessApply,
        tc: []
    },
    "PERFORM-ACTION-DELETE-ATTACHMENT": {
        t: 3,
        f: ARProcessDeleteAttach,
        tc: [2]
    },
    "PERFORM-ACTION-EXIT-APP": {
        t: 5,
        f: ARProcessExitApp,
        tc: []
    },
    "PERFORM-ACTION-GET-FIELD-LABEL": {
        t: 6,
        f: ARProcessGetFieldLabel,
        tc: [2]
    },
    "PERFORM-ACTION-GET-PREFERENCE": {
        t: 2,
        f: ARProcessGetPreference,
        tc: [2, 4]
    },
    "PERFORM-ACTION-GO-HOME": {
        t: 1,
        f: ARProcessGoHome,
        tc: []
    },
    "PERFORM-ACTION-HOME-FIELD-REFRESH": {
        t: 1,
        f: ARProcessHomeFieldRefresh,
        tc: []
    },
    "PERFORM-ACTION-NEXT": {
        t: 5,
        f: ARProcessResultsListNext,
        tc: []
    },
    "PERFORM-ACTION-OPEN-ATTACHMENT": {
        t: 3,
        f: ARProcessDisplayAttach,
        tc: [2]
    },
    "PERFORM-ACTION-OPEN-URL": {
        t: 1,
        f: ARProcessOpenURL,
        tc: [4, 4]
    },
    "PERFORM-ACTION-PREV": {
        t: 5,
        f: ARProcessResultsListPrev,
        tc: []
    },
    "PERFORM-ACTION-REFRESH-PREFERENCE": {
        t: 1,
        f: ARProcessRefreshPreference,
        tc: [2]
    },
    "PERFORM-ACTION-SAVE-ATTACHMENT": {
        t: 3,
        f: ARProcessSaveAttach,
        tc: [2, 4]
    },
    "PERFORM-ACTION-SEND-EVENT": {
        t: 1,
        f: ARProcessSendEvent,
        tc: [4, 4, 4]
    },
    "PERFORM-ACTION-SET-PREFERENCE": {
        t: 1,
        f: ARProcessSetPreference,
        tc: [2, 4]
    },
    "PERFORM-ACTION-SET-SCREEN-PREFERENCE": {
        t: 1,
        f: ARProcessSetScreenPreference,
        tc: [2, 4]
    },
    "PERFORM-ACTION-TABLE-CLEAR": {
        t: 1,
        f: ARProcessTableClear,
        tc: [2]
    },
    "PERFORM-ACTION-TABLE-CLEAR-ROWCHANGED": {
        t: 1,
        f: ARProcessTableSetRowState,
        tc: [2]
    },
    "PERFORM-ACTION-TABLE-DESELECTALL": {
        t: 5,
        f: ARProcessTableDeselectAll,
        tc: [2]
    },
    "PERFORM-ACTION-TABLE-NEXT-CHUNK": {
        t: 5,
        f: ARProcessTableNextChunk,
        tc: [2]
    },
    "PERFORM-ACTION-TABLE-PREV-CHUNK": {
        t: 5,
        f: ARProcessTablePrevChunk,
        tc: [2]
    },
    "PERFORM-ACTION-TABLE-REFRESH": {
        t: 5,
        f: ARProcessTableRefresh,
        tc: [2, 2, 2]
    },
    "PERFORM-ACTION-TABLE-REPORT": {
        t: 5,
        f: ARProcessTableReport,
        tc: [2]
    },
    "PERFORM-ACTION-TABLE-SELECTALL": {
        t: 5,
        f: ARProcessTableSelectAll,
        tc: [2]
    },
    "PERFORM-ACTION-TABLE-GET-SELECTED-COLUMN": {
        t: 2,
        f: ARProcessTableGetSelectedColumn,
        tc: [2, 2]
    },
    "PERFORM-ACTION-TABLE-SELECT-NODE": {
        t: 7,
        f: ARProcessTableSelectNode,
        tc: [2, 2, 2, 2]
    },
    "PERFORM-ACTION-TABLE-IS-LEAF-SELECTED": {
        t: 6,
        f: ARProcessTableIsLeafSelected,
        tc: [2]
    },
    "SET-CHANGE-FLAG": {
        t: 1,
        f: ARProcessSetChangeFlag,
        tc: [2]
    },
    "SET-RO-COLOR": {
        t: 1,
        f: ARProcessSetROColour,
        tc: [4]
    },
    "PERFORM-ACTION-NAV-FIELD-SET-SELECTED-ITEM": {
        t: 1,
        f: ARProcessNavFieldSetSelectedItem,
        tc: [2]
    },
    "APPLICATION-COPY-FIELD-VALUE": {
        t: 2,
        f: ARProcessCopyFieldValue,
        tc: [2, 2]
    },
    "PERFORM-ACTION-MAP-GROUPIDS-TO-NAMES": {
        t: 6,
        f: ARProcessGroupIdsToName,
        tc: [4]
    },
    "PERFORM-ACTION-TABLE-SET-ROWSTATE": {
        t: 1,
        f: ARProcessTableSetRowState,
        tc: [2, 2, 2]
    },
    "PERFORM-ACTION-TABLE-ADD-ROW": {
        t: 5,
        f: ARProcessTableAddRow,
        tc: [2, 2, 2]
    },
    "PERFORM-ACTION-TABLE-DELETE-ROW": {
        t: 5,
        f: ARProcessTableDeleteRow,
        tc: [2, 2, 2]
    },
    "PERFORM-ACTION-LIST-APPEND": {
        t: 1,
        f: ARProcessListAppend,
        tc: [2, 4]
    },
    "PERFORM-ACTION-MAP-PUT": {
        t: 1,
        f: ARProcessMapPut,
        tc: [2, 4, 4]
    },
    "PERFORM-ACTION-TABLE-CLEAR-DELETED": {
        t: 5,
        f: ARProcessTableClearDeleted,
        tc: [2, 2, 2]
    },
    "PERFORM-ACTION-TABLE-CHANGE-ROW-COL-VISIBILITY": {
        t: 1,
        f: ARProcessTableChangeVisibility,
        tc: [2, 2, 4]
    },
    "PERFORM-ACTION-TABLE-GET-CURRENT-CHUNK": {
        t: 2,
        f: ARProcessTableGetCurChunk,
        tc: [2]
    },
    "PERFORM-ACTION-GET-ENTRY": {
        t: 5,
        f: ARProcessGetEntry,
        tc: [4]
    },
    "PERFORM-ACTION-VALIDATE-NULL-REQUIRED-FIELDS": {
        t: 5,
        f: ARProcessValidateNullRequiredFields,
        tc: [4, 4]
    },
    "PERFORM-ACTION-CLEAR-PROMPTBAR": {
        t: 5,
        f: ARProcessHidePromptBar,
        tc: []
    },
    "PERFORM-ACTION-CHANGE-MODE": {
        t: 5,
        f: ARProcessChangeMode,
        tc: [4]
    },
    "PERFORM-ACTION-SHOW-TOOLBAR": {
        t: 5,
        f: ARProcessShowToolbar,
        tc: [4]
    }
};
function ARACTProcess(f, d, b, s) {
    LogWrite('ARACTProcess("' + d + '", ' + f + '", ' + b + ")");
    var q = d.search(/\s/);
    var g = (q > 0) ? d.substring(0, q).toUpperCase() : d.toUpperCase();
    var k = [];
    var p = true;
    if (g in ARRPValues) {
        k = ARRPValues[g].tc
    } else {
        p = false
    }
    d = ExpandStringProcess(f, d, 1 | 2 | 4 | 16 | 8, k, p);
    var q = d.search(/\s/);
    var g = (q > 0) ? d.substring(0, q).toUpperCase() : d.toUpperCase();
    g = g.trim(1 | 2);
    if ((g in ARRPValues) || (((q = d.indexOf(":")) > 0) && ((g = d.substring(0, q).toUpperCase()) == "JAVASCRIPT"))) {
        var o = ARRPValues[g];
        if ((o.t & b) != 0) {
            d = (q > 0) ? d.substring(q + 1).trim(1) : "";
            if ((((o).t & 4) != 0)) {
                if ((b & 2) && (((o).t & 2) != 0)) {
                    return {
                        c: {
                            f: o.f,
                            a: [f, d, s]
                        }
                    }
                } else {
                    return {
                        c: {
                            f: o.f,
                            a: [f, d]
                        }
                    }
                }
            } else {
                if ((((o).t & 2) != 0)) {
                    if (typeof s == "undefined") {
                        var h = {};
                        o.f(f, d, h);
                        return h.result
                    } else {
                        return {
                            c: {
                                f: o.f,
                                a: [f, d, s]
                            }
                        }
                    }
                } else {
                    o.f(f, d);
                    return
                }
            }
        } else {
            if ((b & 2) != 0) {
                getCurWFC_NS(f).status(9281)
            } else {
                getCurWFC_NS(f).status(9300)
            }
        }
    }
    getCurWFC_NS(f).status(9366)
}
function ARACTServerProcess(h, v, w, s, k, d, q) {
    var o = ARKWGetStringByIdx(h, 7);
    var g = new Array();
    var b = new Array();
    FieldList.PopulateValueAndTypeArrays(h, q, g, b);
    var f = new Array();
    var p = new Array();
    FieldList.PopulateValueAndTypeArrays(h, d, f, p);
    var u = new NDXServerRunProcess(h, o, v, w, s, k, d, f, p, q, g, b);
    if (u.result == "") {
        return Null
    } else {
        return new CharType(u.result)
    }
}
function ARProcessError(b, d) {
    Log("Process not implemented");
    getCurWFC_NS(b).status(9215)
}
function ARProcessSetChangeFlag(d, f) {
    var b = 0;
    if (typeof f != "undefined") {
        b = parseInt(f)
    }
    if (isNaN(b) || (b == 0)) {
        Field_ClearChangedFromRunProcess(d)
    } else {
        Field_SetChanged(d)
    }
}
function ARProcessGetChangeFlag(d, f, b) {
    b.result = Field_GetChanged(d) ? IntegerType.ONE: IntegerType.ZERO
}
function ARByteToHex(b) {
    return ((b < 16) ? "0": "") + b.toString(16)
}
function ARProcessSetROColour(f, k) {
    var h = k.split(",");
    if (h.length == 3) {
        var p = parseInt(h[0]);
        var o = parseInt(h[1]);
        var d = parseInt(h[2]);
        if (!isNaN(p) && !isNaN(o) && !isNaN(d)) {
            var q = "#" + ARByteToHex(p) + ARByteToHex(o) + ARByteToHex(d);
            Field_SetROBackground(f, q)
        }
    }
}
function ARProcessActionActiveLink(b, d) {
    var h = d.match(/\b([0-9]+)\b/g);
    if (h != null) {
        var f = AREventFunction(b, h[0], h[1]);
        if (f) {
            var g = parseInt(h[0]);
            if (g == 4194304 || g == 8388608 || g == 16777216) {
                return alExecuteHover(b, g, parseInt(h[1]))
            } else {
                return f.f.apply(f.h, [b])
            }
        }
    }
}
function ARProcessJavascript(windowID, args, result) {
    var res = eval(args);
    if (res && typeof res == "object" && ("i" in res || "n" in res || "c" in res)) {
        return res
    } else {
        if (typeof result == "object") {
            result.result = new CharType(res)
        }
    }
}
function ARProcessGetFieldLabel(d, g, b) {
    b.result = Null;
    var h = parseInt(g);
    if (!isNaN(h)) {
        var f = F(d, h).GLabel();
        if (f == " ") {
            f = ""
        }
        if (f != null) {
            b.result = new CharType(f)
        }
    }
}
function ARProcessRefreshPreference(d, f) {
    var b = parseInt(f);
    if (!isNaN(b)) {
        ARPrefsRefresh(d, b)
    }
}
var GPSP = /([0-9]+)(-((\"(([^\"]|(\"\"))*)\"?)|(\S+)))?/;
var REPDBQ = /\"\"/g;
function ARProcessGetPreference(d, f, b) {
    var k = f.match(GPSP);
    if (!k || k[1] == "") {
        b.result = new CharType("");
        return
    }
    var h = (k[5] == "") ? k[8] : k[5];
    if (h && k[7] && k[7] != "") {
        h = h.replace(REPDBQ, '"')
    }
    var g = ARPrefsGet(d, parseInt(k[1]), h);
    b.result = (g == null) ? new CharType("") : new CharType("" + g)
}
function ARProcessHomeFieldRefresh(b) {
    DAppList.Refresh(b)
}
function ARProcessGoHome(b) {
    FormAction_OpenHomePage(b)
}
var URLRE = /[a-zA-Z]+:[\/]*(.*)/mg;
function ARProcessOpenURL(d, k) {
    var o = true;
    if (k != "") {
        var q = k.split(" ");
        if (q[0].compareToIgnoreCase("new") || q[0].compareToIgnoreCase("current") || q[0].compareToIgnoreCase("newwithouttoolbar")) {
            if (q.length > 2) {
                var g = q[1];
                for (var s = 2; s < q.length; s++) {
                    g = g + " " + q[s]
                }
                q = new Array(q[0], g)
            }
        } else {
            if (q.length > 1) {
                q = new Array(k)
            }
        }
        if (q.length > 0 && q.length <= 2) {
            var p;
            if (q.length == 1 || q[0].compareToIgnoreCase("new")) {
                p = ("" + new Date().getTime()) + "_" + d
            } else {
                if (q[0].compareToIgnoreCase("current")) {
                    p = window.self.name + "_" + d
                } else {
                    if (q[0].compareToIgnoreCase("newwithouttoolbar")) {
                        p = ("" + new Date().getTime()) + "_" + d;
                        o = false
                    }
                }
            }
            if (p) {
                var b = (q.length == 1) ? q[0] : q[1];
                b = b.replace(/(\")|(\\")/g, "");
                var h = b.match(URLRE);
                if (h || b.indexOf("www.") == 0) {
                    if (!h) {
                        b = "http://" + b
                    }
                    var f = allocWindowID_NS();
                    window.weOpen(f, d, b, p, "URL", null, null, o, false);
                    ARKWSet(d, 35, p)
                }
            }
        }
    }
}
function ARProcessExitApp(o) {
    licenseSessionExit(o);
    FieldList.ClearAllGlobals(o);
    var d = false;
    var k = window;
    var b = k;
    var f = weGetAllWindows(o);
    var h = f.length;
    var y = 0;
    for (var u = 0; u < h; u++) {
        var p = f[u].getTopWinWindowID_NS();
        if (((f[u].getARStateCurrent_NS(p) == 1 || f[u].getARStateCurrent_NS(p) == 5) && f[u].getStateMgr_NS(p).IsSaveAllowed(p)) && f[u].getFieldChanged_NS(p)) {
            d = true;
            break
        }
        var q = [];
        f[u].genAllLogicalChildWindowIDsInList(p, q);
        if (y == 0 && q.length > 0) {
            y = 1
        }
        for (var s in q) {
            if (((f[u].getARStateCurrent_NS(q[s]) == 1 || f[u].getARStateCurrent_NS(q[s]) == 5) && f[u].getStateMgr_NS(q[s]).IsSaveAllowed(q[s])) && f[u].getFieldChanged_NS(q[s])) {
                d = true;
                break
            }
        }
    }
    while (b) {
        b = k.weGetOpener(o);
        if (b && !b.closed) {
            if (!b.weGetOpener) {
                break
            }
            k = b
        } else {
            break
        }
    }
    var w = {};
    var v = {};
    if (d) {
        if (h <= 1 && y == 0 && !getStateMgr_NS(o).IsSaveAllowed(o)) {
            d = false
        } else {
            var v = {};
            var g = getLocalizedMessage("Your changes have not been saved or sent.  Do you really want to close the window?");
            w.c = {
                f: ConfirmPopup,
                a: [o, g, v, 4 | 8]
            }
        }
    }
    w.n = {
        f: ExitApp,
        a: [o, d, v, f, k, MarkLogoutOnWindowsRecur]
    };
    return w
}
function ExitApp(d, g, f, o, k, h) {
    var b = {};
    if (getCurWFC_NS(d).notes.length > 0) {
        b.c = {
            f: WC_DisplayMessage,
            a: [d, getCurWFC_NS(d).notes]
        }
    }
    b.n = {
        f: function(p) {
            getCurWFC_NS(p).notes = [];
            if (!g || (("v" in f.result) && f.result.v == 1)) {
                if (g) {
                    for (var q = 0; q < o.length; q++) {
                        o[q].Field_ClearChangedFromRunProcess(p)
                    }
                }
                if (typeof k.window.func != "undefined") {
                    k.window.func(getTopWinWindowID_NS(), k)
                }
                k.window.weCloseAllWindows(getTopWinWindowID_NS(), k, true, (AbsContextPath + "servlet/LogoutServlet"));
                throw new WorkflowException(p, 0, [])
            }
        },
        a: [d]
    };
    return b
}
function MarkLogoutOnWindowsRecur(b, h) {
    if (!h.closed && globalLogout) {
        try {
            h.globalLogout = true;
            h.onbeforeunload = null;
            h.onunload = null
        } catch(g) {}
    }
    var d = getChildWindowIDs(b);
    if (!h.closed && d != null) {
        for (i in d) {
            var f = d[i].windowObj;
            if (f) {
                arguments.callee(f)
            }
        }
    }
}
function GetAttachField(b, g) {
    var d = g.split(" ");
    if (d.length > 0) {
        var k = parseInt(d[0]);
        var h = F(b, k);
        if (h && (h instanceof JAttachment || h instanceof DAttachmentPool)) {
            return h
        }
    }
    return null
}
function ARProcessAddAttach(d, g, b) {
    var h = GetAttachField(d, g);
    if (h) {
        return h.Add(b)
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
}
function ARProcessDeleteAttach(d, g, b) {
    var h = GetAttachField(d, g);
    if (h) {
        return h.Delete(b)
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
}
function ARProcessDisplayAttach(d, g, b) {
    var h = GetAttachField(d, g);
    if (h) {
        return h.Display(b)
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
}
function ARProcessSaveAttach(d, o, b) {
    var p = GetAttachField(d, o);
    if (p) {
        var k = o.split(" ");
        var h = null;
        if (k.length >= 2) {
            h = k[1];
            if (h.charAt(0) == '"' && h.charAt(h.length - 1) == '"') {
                h = h.substr(1, h.length - 2);
                var g = /""/g;
                h = h.replace(g, '"')
            }
        }
        return p.SaveToDisk(b, h)
    } else {
        if (b) {
            b.result = JAttachment.FAILED
        }
    }
}
var SPSP = /([0-9]+)(-((\"(([^\"]|(\"\"))*)\"?)|(\S+)))?(\s+(.*))?/;
function ARProcessSetPreference(b, d) {
    var h = d.match(SPSP);
    if (!h || h[1] == "") {
        return
    }
    var g = (h[5] == "") ? h[8] : h[5];
    if (g && h[7] && h[7] != "") {
        g = g.replace(REPDBQ, '"')
    }
    var f = h[10] ? h[10] : "";
    ARPrefsSet(b, parseInt(h[1]), g, f)
}
function ARProcessSetScreenPreference(b, f) {
    if (f != "") {
        var d = f.match(/[^\s]+/g);
        var g = parseInt(d[0]);
        if (d.length > 1 && !isNaN(g)) {
            ARPrefsSetAsString(g, d[1])
        }
    }
}
function ARProcessApply(b, d) {
    return FormAction_GenericApply(b)
}
function ARProcessGetTableField(b, d) {
    var g = parseInt(d);
    if (!isNaN(g)) {
        var f = F(b, g);
        if (f instanceof DTable) {
            return f
        }
    }
    return null
}
function ARProcessTableClear(b, d) {
    var f = ARProcessGetTableField(b, d);
    if (f) {
        f.Clear();
        f.TriggerEventRefresh()
    }
}
function ARProcessTableRefresh(b, f) {
    var h = ARProcessGetTableField(b, f);
    if (h) {
        var k = -1;
        var g = 0;
        f = f.split(/\s/);
        if (f.length > 1) {
            var d = parseInt(parseFloat(f[1]));
            if (!isNaN(d)) {
                k = d - 1;
                if (k < 0) {
                    k = 0
                }
            }
            if (f.length > 2) {
                var d = parseInt(parseFloat(f[2]));
                if (!isNaN(d)) {
                    g = d;
                    if (g < 0) {
                        g = 0
                    }
                }
            }
        }
        return h.Refresh(k, g, false, 0)
    }
}
function ARProcessTableSelectAll(b, d) {
    var f = ARProcessGetTableField(b, d);
    if (f) {
        return f.SelectAll(true)
    }
}
function ARProcessTableDeselectAll(b, d) {
    var f = ARProcessGetTableField(b, d);
    if (f) {
        return f.SelectAll(false)
    }
}
function ARProcessTableNextChunk(b, d) {
    var f = ARProcessGetTableField(b, d);
    if (f) {
        return f.NextChunk(1)
    }
}
function ARProcessTablePrevChunk(b, d) {
    var f = ARProcessGetTableField(b, d);
    if (f) {
        return f.NextChunk( - 1)
    }
}
function ARProcessTableReport(b, d) {
    var f = ARProcessGetTableField(b, d);
    if (f) {
        return f.Report()
    }
}
function ARProcessResultsListPrev(b, d) {
    var g = F(b, 1020);
    if (g) {
        var f = g.G().toInteger();
        if (f != -1) {
            f -= 1;
            if (f < 1) {
                f = g.GetRows()
            }
            return {
                n: {
                    f: g.S,
                    t: g,
                    a: [new IntegerType(f)]
                }
            }
        }
    }
}
function ARProcessResultsListNext(b, d) {
    var g = F(b, 1020);
    if (g) {
        var f = g.G().toInteger();
        if (f != -1) {
            f += 1;
            if (f > g.GetRows()) {
                f = 1
            }
            return {
                n: {
                    f: g.S,
                    t: g,
                    a: [new IntegerType(f)]
                }
            }
        }
    }
}
function ARProcessTableGetSelectedColumn(f, h, b) {
    b.result = Null;
    var k = ARProcessGetTableField(f, h);
    if (k instanceof DTreeView) {
        var d = 0;
        h = h.split(/\s/);
        if (h.length > 1) {
            var g = parseInt(parseFloat(h[1]));
            if (!isNaN(g) && g == 1) {
                d = 1
            }
        }
        b.result = k.GetSelectedColumn(d)
    }
}
function ARProcessTableSelectNode(b, f) {
    var h = ARProcessGetTableField(b, f);
    if (h instanceof DTable) {
        var k = 0;
        var o = -1;
        var g = 0;
        f = f.split(/\s/);
        if (f.length > 1) {
            var d = parseInt(parseFloat(f[1]));
            if (!isNaN(d)) {
                k = d
            }
            if (f.length > 2) {
                var d = parseInt(parseFloat(f[2]));
                if (!isNaN(d) && d > o) {
                    o = d
                }
                if (f.length > 3) {
                    var d = parseInt(parseFloat(f[3]));
                    if (!isNaN(d) && d == 1) {
                        g = 1
                    }
                }
            }
        }
        if (h instanceof DTreeView) {
            if (k == 0) {
                return h.S("0")
            } else {
                if (o == -1 || (k > 100000000 || k < -100000000)) {
                    return h.S(k + "")
                } else {
                    if (k < 0) {
                        return h.SelectNode( - k - 1, o - 1, g, true, false)
                    } else {
                        return h.SelectNode(k - 1, o - 1, g, true, true)
                    }
                }
            }
        } else {
            return h.S(k + "")
        }
    }
}
function ARProcessTableIsLeafSelected(d, f, b) {
    var g = ARProcessGetTableField(d, f);
    if (g instanceof DTreeView) {
        b.result = g.IsLeafSelected()
    } else {
        b.result = IntegerType.ZERO
    }
}
function ARProcessTableSetRowState(b, f) {
    var h = ARProcessGetTableField(b, f);
    if (h) {
        f = f.trim(2);
        f = f.split(/\s/);
        if (f.length > 1) {
            var o = parseInt(parseFloat(f[1]));
            if (isNaN(o)) {
                return
            }
            var k = 0;
            if (f.length > 2) {
                var g = parseInt(parseFloat(f[2]));
                if (!isNaN(g)) {
                    k = g
                }
            }
            if (k >= 0 && k <= 3) {
                h.SetRowState(o - 1, k)
            }
        } else {
            var d = getCurWFC_NS(b).getGuideState();
            if (d != null) {
                if ("table" in d) {
                    h.SetRowState(d.currow, 0);
                    return
                }
            }
            h.SetRowState( - 1, 0)
        }
    }
}
function ARProcessGroupIdsToName(f, o, v) {
    v.result = null;
    var u = o;
    if (u.charAt(0) == '"' && u.charAt(u.length - 1) == '"') {
        u = u.substr(1, u.length - 2)
    } else {
        var q = u.split(" ");
        if (q.length > 1) {
            v.result = new CharType(o);
            return
        }
    }
    u = u.trim(1 | 2);
    var k = "";
    if (u.length > 0) {
        var g = u.split(";");
        var s = g.length;
        s--;
        var d;
        for (var h = 0; h < s; h++) {
            if (k != "") {
                k += " "
            }
            var b = g[h];
            b = b.trim(1 | 2);
            d = getLabel(f, b);
            if (d) {
                k += d
            } else {
                k += b
            }
        }
        v.result = new CharType(k)
    }
}
var ARProcessSendEvent_CmdlineParser = new RegExp('\\s*((\\"(([^"]|(""))*)\\"\\s*)|([^\\s]*))', "g");
function ARProcessSendEvent(b, h) {
    h = h.trim(1 | 2);
    if (h.length == 0) {
        return
    }
    var g;
    var d = ["", "", ""];
    ARProcessSendEvent_CmdlineParser.lastIndex = 0;
    for (var f = 0; f < d.length && (g = ARProcessSendEvent_CmdlineParser.exec(h)); f++) {
        d[f] = g[3] ? (g[5] ? g[3].replace(REPDBQ, '"') : g[3]) : g[6]
    }
    if (d[0] == "" || d[1] == "") {
        return
    }
    ARProcessEvent.DeliverEvent(b, d[0], d[1], d[2])
}
function ARProcessNavFieldSetSelectedItem(b, f) {
    var d = parseInt(f);
    if (!isNaN(d) && F(b, d) instanceof DNavBarItem) {
        F(b, d).SetSelected()
    }
}
var CPEX = /([0-9]+)(\s+)([0-9]+)/;
function ARProcessCopyFieldValue(f, g, d) {
    var k = g.match(CPEX);
    if (k == null) {
        d.result = new IntegerType(1);
        return
    }
    var o = k[1];
    var h = k[3];
    var b = getFields_NS(f);
    if (h in b && o in b) {
        F(f, o).S((F(f, h).G()));
        d.result = new IntegerType(0)
    } else {
        d.result = new IntegerType(1)
    }
}
function ARProcessTableAddRow(b, f) {
    var d = f.split(/\s/);
    var k = ARProcessGetTableField(b, d[0]);
    var g = null,
    h = null,
    o = null;
    if (k && k.mID != 1020 && k.mID != 706) {
        if (!k.mResult) {
            k.initResults()
        }
        if (d.length == 1 || (d.length > 1 && d[1] == "")) {
            h = k.GetData().length + 1;
            d.push(h);
            o = h
        } else {
            if (d[1] == 0) {
                return
            } else {
                h = computeRowIndex(d[1], k.GetData().length);
                if (d[1] > 100000000) {
                    o = 100000000 + h
                } else {
                    if (d[1] < -100000000) {
                        o = -(100000000 + h)
                    } else {
                        o = h
                    }
                }
            }
        }
        k.addRowToData(h);
        k.mARRowSelection = -1;
        g = k.S(new IntegerType(o));
        if (k.mHdrLObj) {
            k.mHdrLObj.innerHTML = ""
        }
        k.DataChanged()
    }
    return g
}
function ARProcessTableDeleteRow(b, f) {
    var d = f.split(/\s/);
    var g = null;
    if (d.length < 2) {
        return
    }
    var h = ARProcessGetTableField(b, d[0]);
    if (!h || h.mID == 1020 || h.mID == 706) {
        return
    }
    if (d[1] > 0 && d[1] <= h.GetData().length) {
        if (h && h.mResult) {
            h.mResult.r[d[1] - 1].mXXXDirty = 3;
            if (d.length > 2) {
                g = h.S(new IntegerType(d[2]))
            }
            if (h.mHdrLObj) {
                h.mHdrLObj.innerHTML = ""
            }
            h.DataChanged()
        }
    }
    return g
}
function computeRowIndex(d, b) {
    if (d == null) {
        return b + 1
    }
    if (d < 0) {
        d = -d
    }
    if (d > 100000000) {
        d = d - 100000000
    }
    if (d > b) {
        return b + 1
    } else {
        return d
    }
}
function ARProcessListAppend(g, p) {
    var h = p.split(/\s/);
    if (h == null || h.length < 2) {
        return
    }
    var f = h[0];
    if (f == null) {
        return
    }
    var d = "";
    for (var k = 1; k < h.length; k++) {
        d += h[k]
    }
    var b = d.length;
    if (d.charAt(0) == '"' && d.charAt(b - 1) == '"' && d.length > 2) {
        d = d.substring(1, b - 1)
    }
    var o = ARR(g, f);
    if (o == null) {
        return
    }
    o.append(d)
}
function ARProcessMapPut(b, h) {
    var o = h.split(/\s/);
    if (o == null || o.length < 3) {
        return
    }
    var p = o[0];
    if (p == null) {
        return
    }
    var k = o[1];
    var q = "";
    for (var f = 2; f < o.length; f++) {
        q += o[f]
    }
    var g = q.length;
    if (q.charAt(0) == '"' && q.charAt(g - 1) == '"' && q.length > 2) {
        q = q.substring(1, g - 1)
    }
    var d = M(b, p);
    if (d == null) {
        return
    }
    d.setValue(k, q)
}
function ARProcessTableClearDeleted(b, f) {
    var d = f.split(/\s/);
    var g = ARProcessGetTableField(b, d[0]);
    if (!g || g.mID == 1020 || g.mID == 706) {
        return
    }
    g.clearDeleted();
    return
}
function ARProcessTableChangeVisibility(d, g) {
    var f = g.split(/\s/);
    if (f == null || f.length < 3) {
        return
    }
    var b = f[0];
    if (b == null) {
        return
    }
    var h = ARProcessGetTableField(d, b);
    if (!h || (h instanceof DTreeView) || (h instanceof DAlertList) || b == 1020 || b == 706) {
        return
    }
    h.setFieldVisibilityOnCurrentRow(f[1], f[2]);
    return
}
function ARProcessTableGetCurChunk(d, f, b) {
    var g = new RegExp("^[0-9]+$");
    if (g.test(f)) {
        var k = parseInt(f);
        if (!isNaN(k)) {
            if (k in getFields_NS(d)) {
                var h = F(d, k);
                if (h instanceof DTable) {
                    if (h.IsRefreshed()) {
                        b.result = new IntegerType(h.mChunkPage + 1);
                        return
                    }
                    b.result = Null;
                    return
                }
                b.result = new IntegerType(1);
                return
            }
        }
    }
    b.result = Null
}
function buildResultListEntry(b, d, o) {
    var h = F(b, 1020);
    h.mResult = {
        eid: null,
        f: [],
        idmap: [],
        n: 1,
        q: null,
        r: [],
        start: 0
    };
    h.mResult.eid = d;
    h.mResult.f.push({
        dt: 4,
        m: null,
        t: "Char"
    });
    h.mResult.idmap[d] = 0;
    h.mResult.q = '{qual:""}';
    var k = new Object();
    k.i = d;
    var g = new Object();
    g.v = "";
    g.p = "";
    k.d = [];
    for (var f = 0; f < h.mColCnt; ++f) {
        if (h.mColDatas[f].mVisible) {
            k.d.push(g)
        }
    }
    k.rc = -1;
    h.mResult.r[0] = k;
    h.mCurrentRow = 0;
    h.mPrimaryRowSelection = d;
    h.mRowSelections = [];
    h.mRowSelections[d] = true;
    h.mNotRefreshed = false;
    h.mResultsListState = o;
    h.mAsyncDirty = 3
}
function ARProcessGetEntry(b, d) {
    if ((getARStateCurrent_NS(b) != 3 && getARStateCurrent_NS(b) != 5) || (typeof d == "undefined" || d == null || d == "")) {
        return
    }
    getForm_NS(b).procGetEntry = true;
    buildResultListEntry(b, d, getARStateCurrent_NS(b));
    return FormAction_SimulateGetEntry(b)
}
function ARProcessValidateNullRequiredFields(b, d) {
    getStateMgr_NS(b).ClearHighlight(b);
    return {
        c: {
            f: function() {
                var p = [];
                var s = d.split(/\s/);
                var g = 1;
                if (s.length > 0) {
                    var q = s[0].replace(/\"/g, "");
                    q = q.toLowerCase();
                    if (q == "prompt") {
                        g = 0
                    }
                }
                if (s.length == 1) {
                    var v = getFields_NS(b);
                    for (var h in v) {
                        var u = v[h];
                        checkRequiredFields(u, p)
                    }
                } else {
                    if (s.length == 2) {
                        var f = s[1].replace(/\"/g, "");
                        var k = f.split(/\\/);
                        var o = k.length;
                        for (var h = 0; h < o; h++) {
                            var u = F(b, k[h].trim(1 | 2));
                            checkRequiredFields(u, p)
                        }
                    }
                }
                if (p.length != 0) {
                    getCurWFC_NS(b).status(p, g)
                }
            },
            e: getStateMgr_NS(b).HandleException,
            ea: [b]
        }
    }
}
function checkRequiredFields(f, d) {
    if (f instanceof DataField) {
        if ((f.mCFCache.o == 1 || f.mCFCache.r == 1) && (f.GDefault().mValue == null || (f.GDefault().mValue != null && f.G().isNull && f.IsDirty()))) {
            var b = f.G();
            if (b == null || b.mValue == null || (b.mValue != null && b.mValue.length == 0)) {
                d.push(f.getRequiredException())
            }
        }
    }
}
function ARProcessHidePromptBar() {
    HidePromptBar()
}
function ARProcessChangeMode(b, d) {
    if (weAmDialogue(window.name)) {
        return
    }
    getCurWFC_NS(b).AddCallback(null, SimulateModeChange, [b, d]);
    throw new WorkflowException(b, 0, [])
}
function ARProcessShowToolbar(b, d) {
    ShowToolbar(b, (d != null && (d == "1" || d == 1)))
}
function ARACTSQL(f, s, g, d, k) {
    LogWrite('ARACTSQL("' + f + '",' + s + '",' + g + ", " + d + ", " + k + ")");
    var b = new Array();
    var h = new Array();
    FieldList.PopulateValueAndTypeArrays(f, d, b, h);
    var o = new Array();
    var u = new Array();
    FieldList.PopulateValueAndTypeArrays(f, k, o, u);
    var q = new NDXGetSQLEntryList(f, ARKWGetStringByIdx(f, 7), s, g, 3, 6, d, b, h, k, o, u, true);
    var p = q.result
}
function ARACTSetAllFields(d, b) {
    LogWrite("ARACTSetAllFields()");
    if ((getARStateCurrent_NS(d) == 1) || (getARStateCurrent_NS(d) == 5) || (getARStateCurrent_NS(d) == 6) || (getARStateCurrent_NS(d) == 4)) {
        b.RemoveField(6);
        b.RemoveField(5);
        b.RemoveField(3);
        b.RemoveField(1)
    }
    for (var f in b.mFields) {
        F(d, f).S(b.mFields[f])
    }
}
SvcOutList.prototype.constructor = SvcOutList;
function SvcOutList() {
    this.init()
}
SvcOutList.prototype.init = function() {
    this.mretVals = new Object()
};
SvcOutList.prototype.F = function(b) {
    return (b in this.mretVals) ? this.mretVals[b] : Null
};
SvcOutList.prototype.SV = function(d, b) {
    this.mretVals[d] = Datatype_Factory(b)
};
function ARACTService(windowID, server, formname, requestidField, inmap, outmap, outrefs, arrname) {
    var dynServer = server;
    var dynformname = formname;
    dynServer = ExpandString(windowID, dynServer, 1 | 2 | 4);
    dynformname = ExpandString(windowID, dynformname, 1 | 2 | 4);
    var dynrequestid = "";
    if (requestidField != 0) {
        dynrequestid = dynrequestid + F(windowID, requestidField).G()
    }
    var inIds = new Array();
    var inVals = new Array();
    var inTypes = new Array();
    for (var id in inmap) {
        var value = inmap[id];
        if (value.t != "dt") {
            inIds.push(parseInt(id));
            inVals.push(value.v.toPrimitive());
            inTypes.push(value.v.type)
        }
    }
    var inlist = [];
    for (var x = 0; x < inIds.length; x++) {
        inlist.push(inIds[x] + ":" + inVals[x])
    }
    var inliststr = "inmap:";
    if (inlist.length > 0) {
        inliststr = inliststr + "[" + inlist.join(",") + "]"
    }
    var outlist = [];
    for (var y in outmap) {
        outlist.push(outmap[y].f + ":" + outmap[y].e)
    }
    var outliststr = "outmap:";
    if (outlist.length > 0) {
        outliststr = outliststr + "[" + outlist.join(",") + "]"
    }
    LogWrite("ARACTService(" + windowID + ", " + server + ", " + formname + ", " + requestidField + "," + inliststr + "," + outliststr + ")");
    if (dynServer != server) {
        LogWrite("ARACTService server:" + dynServer)
    }
    if (dynformname != formname) {
        LogWrite("ARACTService formname:" + dynformname)
    }
    if (requestidField != 0) {
        LogWrite("ARACTService request id:" + dynrequestid)
    }
    eval("var " + arrname + "= new SvcOutList()");
    var req = new NDXExecuteService(windowID, dynServer, dynformname, dynrequestid, inIds, inVals, inTypes, outrefs, arrname);
    var res = req.result;
    if (res != 0) {
        eval(res.oa);
        var newval;
        for (var index in outmap) {
            eval("newval =" + outmap[index].e);
            LogWrite("F(" + outmap[index].f + ").S(" + newval.toDbgString() + ")");
            if (outmap[index].f in getFields_NS(windowID)) {
                F(windowID, outmap[index].f).S(newval)
            }
        }
    }
}
function SelectionPopup(d, b, f) {
    b.title = getLocalizedMessage("Selection list");
    b.appss = GetAppStyleSheet("../../");
    return weOpenModalPopup(d, (AbsContextPath + "resources/html/SelectionPopup.html"), "Selection", b, f, [640, 320])
}
DDisplay.prototype = new DView();
DDisplay.prototype.constructor = DDisplay;
DDisplay.superclass = DView.prototype;
JDisplay.prototype = new JView();
JDisplay.prototype.constructor = JDisplay;
JDisplay.superclass = JView.prototype;
DOMFieldFactories.Display = function(b, f, d) {
    return new DDisplay(b, f, d)
};
function DDisplay(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DDisplay.prototype.init = function(b, f, d) {
    DDisplay.superclass.init.call(this, b, f, d);
    this.DataDefault()
};
DDisplay.prototype.mHaveStoredData = false;
DDisplay.prototype.Clear = function() {
    return
};
DDisplay.prototype.GDefault = function() {
    this.val = Null;
    if ("d" in getDefaults_NS(this.windowID)[this.mID]) {
        return (new CharType(ExpandString(this.windowID, "" + getDefaults_NS(this.windowID)[this.mID].d, 2)))
    }
    return null
};
DDisplay.URLTypeParamsRE = new RegExp("[?|&]([^=]*)=([^&]*)", "g");
DDisplay.RegularParamsRE = new RegExp('\\s*([^=\\s,]+)\\s*=((\\s*([^",]+\\"[^"]*\\"[^",]*)*\\s*)|(\\s*\\"(([^"]|(""))*)\\"\\s*)|([^,]*))(,|$)', "g");
DDisplay.HTTPPAT = new RegExp("^https?:[\\\\/][\\\\/].*", "i");
DDisplay.CURRENTSERVER = new RegExp("^((%40)|@)$");
DDisplay.replaceRegExpSuffix = ")=[^&]*";
DDisplay.PLUGIN_CONTEXT = "plugins/";
DDisplay.PLUGIN_CONTEXT_SUFF = "/params";
DDisplay.PluginNameReplaceRE = new RegExp("(.*/)" + DDisplay.PLUGIN_CONTEXT + "[^/]+" + DDisplay.PLUGIN_CONTEXT_SUFF);
DDisplay.prototype.DoSet = DDisplay.prototype.DoSetLoadEntry = function(g) {
    if (g.isNull) {
        return
    } else {
        g = g.toString()
    }
    var q = {};
    var k = [];
    if (g.match(DDisplay.HTTPPAT)) {
        var o;
        while (o = DDisplay.URLTypeParamsRE.exec(g)) {
            k.push("(" + o[1] + ")");
            q[(o[1] != "windowID") ? o[1].toLowerCase() : o[1]] = o[2]
        }
    } else {
        var o;
        while (o = DDisplay.RegularParamsRE.exec(g)) {
            k.push("(" + o[1] + ")");
            var y = o[3] ? o[3] : (o[4] ? o[4] : (o[6] ? (o[8] ? o[6].replace(/\"\"/g, '"') : o[6]) : o[9]));
            if (typeof y == "undefined" || y == null) {
                y = ""
            }
            q[o[1].toLowerCase()] = encodeURIComponent(y)
        }
    }
    k.push("(rtl)");
    var s = "ltr";
    q.rtl = s;
    if (k.length > 0) {
        var h = q.server;
        if (h && h.match(DDisplay.CURRENTSERVER)) {
            q.server = encodeURIComponent(ARKWGetStringByIdx(this.windowID, 7))
        }
        if (this.mContainerID != null) {
            var b = parseInt(this.GetFocusElement().offsetWidth);
            var v = parseInt(this.GetFocusElement().offsetHeight);
            if (q.width && b > 0) {
                q.width = b
            }
            if (q.height && v > 0) {
                q.height = v
            }
        }
        var f = "[?|&](" + k.join("|");
        f += DDisplay.replaceRegExpSuffix;
        var p;
        var d;
        if (this.val.isNull) {
            h = q.plugin;
            delete q.plugin;
            p = (AbsContextPath + DDisplay.PLUGIN_CONTEXT + h + DDisplay.PLUGIN_CONTEXT_SUFF + "?");
            q.fieldid = this.mID;
            q.windowID = this.windowID;
            h = ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : "");
            if (h != "") {
                q.appname = encodeURIComponent(h)
            }
            d = true
        } else {
            d = false;
            h = q.plugin;
            p = this.val.toString();
            if (h) {
                p = p.replace(DDisplay.PluginNameReplaceRE, "$1" + DDisplay.PLUGIN_CONTEXT + h + DDisplay.PLUGIN_CONTEXT_SUFF);
                delete q.plugin;
                this.disableSetFieldsEvent()
            }
            p = p.replace(new RegExp(f, "gi"),
            function(B, C) {
                var A = q[C];
                delete q[C];
                return B.charAt(0) + C + "=" + A
            })
        }
        var w = [];
        for (var u in q) {
            w.push(u + "=" + q[u])
        }
        if (w.length > 0) {
            if (!d) {
                p += "&"
            }
            p += w.join("&")
        }
        DDisplay.superclass.DoSet.call(this, new CharType(p))
    }
};
DDisplay.prototype.setContents = function() {
    DDisplay.superclass.setContents.call(this);
    initSessionTimeoutCounter()
};
DDisplay.fbDrillDown = function(g, f, b, d) {
    new WorkflowContext({
        f: ARACTOpenQueryWindow,
        a: [g, f, b, "New", 10, d, 1, null, false, [], null, null, {}]
    })
};
DDisplay.prototype.isSetFieldsEventEnabled = function() {
    var f = false;
    try {
        var b = window.frames[this.mFrameName];
        if (b != null && typeof b.EventDispatcher != "undefined" && typeof b.EventDispatcher.isSetFieldsEventEnabled == "function") {
            f = b.EventDispatcher.isSetFieldsEventEnabled()
        }
    } catch(d) {}
    return f
};
DDisplay.prototype.setFieldsAsEvent = function(f) {
    try {
        var b = window.frames[this.mFrameName];
        if (b != null && typeof b.EventDispatcher != "undefined") {
            b.EventDispatcher.dispatch("ACT-SET-FIELDS-EVENT", f)
        }
    } catch(d) {}
};
DDisplay.prototype.disableSetFieldsEvent = function() {
    try {
        var b = window.frames[this.mFrameName];
        if (b != null && typeof b.EventDispatcher != "undefined" && typeof b.EventDispatcher.disableSetFieldsEvent == "function") {
            b.EventDispatcher.disableSetFieldsEvent()
        }
    } catch(d) {}
};
JFieldFactories.Display = function(b, f, d) {
    return new JDisplay(b, f, d)
};
function JDisplay(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DAppList.prototype = new DView();
DAppList.prototype.constructor = DAppList;
DAppList.superclass = DView.prototype;
JAppList.prototype = new JView();
JAppList.prototype.constructor = JAppList;
JAppList.superclass = JView.prototype;
DOMFieldFactories.AppList = function(b, f, d) {
    return new DAppList(b, f, d)
};
function DAppList(g, f, d) {
    if (arguments.length) {
        this.init(g, f, d)
    }
}
DAppList.prototype.init = function(b, f, d) {
    DAppList.superclass.init.call(this, b, f, d);
    this.loaded = false;
    if (this.mode == 1) {
        this.inFill = false;
        if (this.mObj.getAttribute("arcontainerid")) {
            this.inFill = true
        }
        if (this.mObj.getAttribute("arparentid")) {
            this.mContainerID = this.mObj.getAttribute("arparentid");
            if (this.inFill == false) {
                this._top = this.mObj.style.top;
                this._left = this.mObj.style.left
            }
        }
        this.rootFlyout = this.mObj.childNodes[1];
        this.mContainFields = true;
        this.mModified = true
    }
};
DAppList.prototype.getList = function() {
    var p = document.createElement("DIV");
    p.style.align = "center";
    p.style.valign = "center";
    p.style.position = "relative";
    p.style.left = "40%";
    p.style.top = "40%";
    p.style.visibility = "visible";
    p.style.display = "inline";
    p.innerHTML = "<img src=" + AbsContextPath + "resources/images/Progress_NonModal-circle.gif></img>" + getLocalizedMessage("Loading...");
    this.rootFlyout.appendChild(p);
    var f = null;
    if ("" + 1576 in getFields_NS(this.windowID)) {
        f = getFields_NS(this.windowID)[1576].G().toString()
    }
    var b = encodeURIComponent(ARKWGetStringByIdx(this.windowID, 7));
    var g = encodeURIComponent(ARKWGetStringByIdx(this.windowID, 6));
    var o = encodeURIComponent(ARKWGetStringByIdx(this.windowID, 17));
    var h = RelContextPath + "forms/" + b + "/" + g + "/" + o + "/AppList.html?cacheid=" + getFormDataHolderById(this.windowID).cacheid + "&format=html";
    if (f != null && f != "") {
        h += "&AppListSubset=" + encodeURIComponent(f)
    }
    var d = "&mode=" + this.mode + "&mID=" + this.mID;
    var q = GET_XML_HTTP();
    q.open("GET", h + d, true);
    q.setRequestHeader("Content-type", "text/plain; charset=UTF-8");
    var s = this;
    q.onreadystatechange = function() {
        if (q.readyState == 4) {
            if (q.responseText.indexOf(9201) == -1) {
                initSessionTimeoutCounter();
                s.loaded = true;
                var u = parseScript(q.responseText);
                s.rootFlyout.innerHTML = u;
                if (q.responseText.length > 0) {
                    Field_Init(s.windowID, s.rootFlyout);
                    setHandlers(s.windowID, s.mObj)
                }
            }
        }
    };
    try {
        q.send(d)
    } catch(k) {
        alert(k.message)
    }
};
function parseStyle(b) {
    var d = b;
    var u = new Array();
    while (d.indexOf("<style") > -1 || d.indexOf("</style") > -1) {
        var v = d.indexOf("<style");
        var k = d.indexOf(">", v);
        var o = d.indexOf("</style", v);
        var h = d.indexOf(">", o);
        u.push(d.substring(k + 1, o));
        d = d.substring(0, v) + d.substring(h + 1)
    }
    for (var g = 0; g < u.length; g++) {
        try {
            var q = document.getElementsByTagName("head")[0];
            var f = document.createElement("style");
            f.type = "text/css";
            f.appendChild(document.createTextNode(u[g]));
            q.appendChild(f)
        } catch(p) {}
    }
    return d
}
function parseScript(b) {
    var d = b;
    var f = new Array();
    while (d.indexOf("<script") > -1 || d.indexOf("<\/script") > -1) {
        var v = d.indexOf("<script");
        var k = d.indexOf(">", v);
        var o = d.indexOf("<\/script", v);
        var h = d.indexOf(">", o);
        f.push(d.substring(k + 1, o));
        d = d.substring(0, v) + d.substring(h + 1)
    }
    for (var g = 0; g < f.length; g++) {
        try {
            var u = document.getElementsByTagName("head")[0];
            var q = document.createElement("SCRIPT");
            q.type = "text/javascript";
            q.appendChild(document.createTextNode(f[g]));
            u.appendChild(q)
        } catch(p) {}
    }
    return d
}
DAppList.prototype.mContainFields = false;
DAppList.Load = function(b) {
    var d = getFields_NS(b)[1575];
    if (d && d instanceof DAppList && !d.loaded) {
        DAppList.Refresh(b)
    }
};
function OpenWindow(f, d, g, h) {
    var b = getCurrentWindowID_NS();
    f = f.replace(/\\/g, "\\\\");
    d = d.replace(/\\/g, "\\\\");
    if (getCurWFC_NS(b)) {
        return getCurWFC_NS(b).execute({
            f: ARACTOpenWindow,
            a: [b, f, d, "", "New", h, null, g, null, null]
        })
    }
    new WorkflowContext(b, {
        f: ARACTOpenWindow,
        a: [b, f, d, "", "New", h, null, g, null, null]
    })
}
function OpenAppWindow(f, d) {
    var b = getCurrentWindowID_NS();
    if (d.shiftKey == true) {
        if (getCurWFC_NS(b)) {
            return getCurWFC_NS(b).execute({
                f: OpenNonModalURL,
                a: [b, f, 1, "" + new Date().getTime()]
            })
        }
        new WorkflowContext(b, {
            f: OpenNonModalURL,
            a: [b, f, 1, "" + new Date().getTime()]
        })
    } else {
        if (getCurWFC_NS(b)) {
            return getCurWFC_NS(b).execute({
                f: OpenNonModalURL,
                a: [b, f, 2, "" + new Date().getTime()]
            })
        }
        new WorkflowContext(b, {
            f: OpenNonModalURL,
            a: [b, f, 2, "" + new Date().getTime()]
        })
    }
}
DAppList.Refresh = function(d) {
    var f = getFields_NS(d)[1575];
    if (f && f instanceof DAppList) {
        var o = null;
        if ("" + 1576 in getFields_NS(d)) {
            o = getFields_NS(d)[1576].G().toString()
        }
        var k = encodeURIComponent(ARKWGetStringByIdx(d, 7));
        var h = encodeURIComponent(ARKWGetStringByIdx(d, 6));
        var b = encodeURIComponent(ARKWGetStringByIdx(d, 17));
        var g = (AbsDocumentPath + "AppList.html?cacheid=" + getFormDataHolderById(d).cacheid + "&format=html");
        if (o != null && o != "") {
            g += "&AppListSubset=" + encodeURIComponent(o)
        }
        f.loaded = true;
        DAppList.superclass.DoSet.call(f, new CharType(g))
    }
};
DAppList.prototype.DoSet = DAppList.prototype.DoSLoadEntry = JAppList.prototype.DoSet = JAppList.prototype.DoSLoadEntry = function(b) {};
DAppList.prototype.ol = function() {
    var d = window.frames[this.mFrameName];
    try {
        if (d.document && d.document.body) {
            if (! (d.document.body.style.backgroundColor)) {
                d.document.body.style.backgroundColor = "transparent"
            }
            var g = d.window.Msg;
            if (g) {
                var f = getFields_NS(this.windowID)[1575];
                if (f) {
                    DAppList.superclass.DoSet.call(f, new CharType("<html><body>" + getLocalizedMessage(g) + "</body></html>"))
                }
            }
        }
    } catch(b) {}
};
DAppList.prototype.mHaveStoredData = JAppList.prototype.mHaveStoredData = false;
function arInvokeEntryPoint(d, h, g) {
    if (typeof h != "string" || typeof g != "string") {
        return
    }
    var f = getFields_NS(d)[1575];
    if (!f.mFrameName) {
        return
    }
    var b = window.frames[f.mFrameName];
    if (!b) {
        return
    }
    h = ExpandServerName(d, h);
    g = ExpandGuideName(d, g);
    var k = "CallARG" + (g + h).ARToJSIdentifier() + "EPFunc";
    if (k in b) {
        return b[k](true)
    } else {
        return
    }
}
function doEval(str) {
    return eval(str)
}
JFieldFactories.AppList = function(b, f, d) {
    return new JAppList(b, f, d)
};
function JAppList(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
JAppList.prototype.init = function(b, f, d) {
    JAppList.superclass.init.call(this, b, f, d);
    this.loaded = false
};
function ParseInvalidNumberInLocaleAsBestWeCan(g, f) {
    if (g == null || g == "") {
        return g
    }
    g = g.replace(f, "$1");
    var d = "",
    b;
    for (b = 0; b < g.length; b++) {
        if (g.charAt(b) == localeInfo.lcDecimalSep) {
            d += "."
        } else {
            if (g.charAt(b) != localeInfo.lcThousandSep) {
                d += g.charAt(b)
            }
        }
    }
    return "" + parseFloat(d)
}
function LCRealToEn_US(k, h) {
    var g = localeInfo.lcDecimalSep;
    if (g == ".") {
        g = "\\."
    }
    var f = new RegExp("^\\s*[+-]?\\d*(" + g + "\\d+)?\\s*$");
    if (!k.match(f)) {
        f = new RegExp("^\\s*[+-]?\\d*(" + g + "\\d+)?[Ee][+-]?\\d+\\s*$");
        if (!k.match(f)) {
            if (h) {
                throw ({
                    t: 2,
                    n: 9373,
                    m: null,
                    a: '"' + k + '"'
                })
            } else {
                var f = new RegExp("^\\s*([+-]?\\d*(" + g + "\\d+)?)(.*)");
                return ParseInvalidNumberInLocaleAsBestWeCan(k, f)
            }
        }
    }
    var d = "",
    b;
    for (b = 0; b < k.length; b++) {
        if (k.charAt(b) == localeInfo.lcDecimalSep) {
            d += "."
        } else {
            if (k.charAt(b) == localeInfo.lcThousandSep) {
                d += ","
            } else {
                d += k.charAt(b)
            }
        }
    }
    return d
}
function En_USRealToLC(f) {
    var d = "",
    b;
    for (b = 0; b < f.length; b++) {
        if (f.charAt(b) == ".") {
            d += localeInfo.lcDecimalSep
        } else {
            if (f.charAt(b) == ",") {
                d += localeInfo.lcThousandSep
            } else {
                d += f.charAt(b)
            }
        }
    }
    return d
}
function En_USDecimalToLC(o) {
    var g = o.replace(".", localeInfo.lcDecimalSep);
    var f = "",
    b = g.length - 1,
    k, d, h = g.indexOf(localeInfo.lcDecimalSep) - 1;
    if (h < 0) {
        h = b
    }
    for (d = 0; d <= b; d++) {
        f += k = g.charAt(d);
        if ((d < h) && ((h - d) % 3 == 0) && (k != "-")) {
            f += localeInfo.lcThousandSep
        }
    }
    return f
}
function LCDecimalToEn_US(o, k) {
    var h = localeInfo.lcDecimalSep;
    if (h == ".") {
        h = "\\."
    }
    var g = localeInfo.lcThousandSep;
    if (g == ".") {
        g = "\\."
    }
    var f = new RegExp("^\\s*[+-]?\\d*(" + g + "\\d\\d\\d)*(" + h + "\\d*)?\\s*$");
    if (!o.match(f)) {
        if (k) {
            throw ({
                t: 2,
                n: 9374,
                m: null,
                a: '"' + o + '"'
            })
        } else {
            f = new RegExp("^\\s*([+-]?[\\d*" + g + "]+(" + h + "\\d*)?)(.*)");
            return ParseInvalidNumberInLocaleAsBestWeCan(o, f)
        }
    }
    var d = "",
    b;
    for (b = 0; b < o.length; b++) {
        if (o.charAt(b) == localeInfo.lcDecimalSep) {
            d += "."
        } else {
            if (o.charAt(b) == localeInfo.lcThousandSep) {} else {
                d += o.charAt(b)
            }
        }
    }
    return d
}
DIVPopup.prototype.constructor = DIVPopup;
var ddGlobal = null;
var gFocusItem = null;
function DIVPopup(b) {
    if (arguments.length) {
        this.init(b)
    }
}
DIVPopup.prototype.init = function(d, k, g, b, h, f) {
    this.windowID = d;
    this.mDiv = null;
    this.mModal = k;
    this.mShowBtn = g;
    this.mX = this.mY = 0;
    this.mIFrame = null;
    this.mOrigin = null;
    this.mDraggable = b;
    this.mResizable = h;
    this.mTitleBar = f;
    this.mW = this.mH = 0
};
DIVPopup.prototype.windowID;
DIVPopup.FindPopup = function(d, g) {
    var b = null;
    if (getOpenDIVPopup_NS(d) != null) {
        while (g && g != document.body) {
            if (g == getOpenDIVPopup_NS(d).mDiv) {
                return getOpenDIVPopup_NS(d)
            } else {
                if (g.className.indexOf("DIVPopup") != -1) {
                    for (var f = 0; f < getCharEditPopups_NS(d).length; f++) {
                        if ((getCharEditPopups_NS(d)[f].mDiv == g) && (getCharEditPopups_NS(d)[f].mDiv.disabled == false)) {
                            b = getCharEditPopups_NS(d)[f]
                        }
                    }
                }
            }
            g = g.parentNode
        }
        if (getOpenDIVPopup_NS(d).ShowSingle()) {
            getOpenDIVPopup_NS(d).HidePopup(true)
        }
    }
    return b
};
DIVPopup.prototype.ShowSingle = function() {
    return ! this.mModal
};
DIVPopup.prototype.OnResize = function(d, f, g, b) {};
DIVPopup.prototype.OnStartDrag = function() {};
DIVPopup.prototype.OnEndDrag = function() {};
DIVPopup.prototype.KeyDown = function(b) {
    if (getOpenDIVPopup_NS(this.windowID) && getOpenDIVPopup_NS(this.windowID).mModal) {
        if (b.key == 27 && typeof(getOpenDIVPopup_NS(this.windowID).OnCancel) == "function") {
            getOpenDIVPopup_NS(this.windowID).OnCancel();
            return false
        }
        if ((b.key == 13 || b.key == 32) && b.element.getAttribute("DIVBTN")) {
            b.element.click();
            return false
        }
    }
    if (b.key == 9) {
        this.DoTab(b, !b.shift);
        b.SetKeyCode(505);
        return false
    }
    return true
};
DIVPopup.prototype.Click = DIVPopup.prototype.KeyPress = function(b) {
    return false
};
DIVPopup.prototype.HidePopup = function(g) {
    if (g && (typeof AnimMgr != "undefined")) {
        var d, o, f, k;
        d = parseInt(this.mDiv.style.left);
        o = parseInt(this.mDiv.style.top);
        if (this.mDiv != null) {
            f = k = 0
        }
        AnimMgr.ZoomIn(this, d, o, f, k)
    } else {
        if (this.mIFrame != null && this.mIFrame.frameElement != null) {
            this.mIFrame.frameElement.src = ""
        }
        document.body.removeChild(this.mDiv)
    }
    var b = getCharEditPopups_NS(this.windowID);
    if (b.length > 0) {
        setOpenDIVPopup_NS(this.windowID, b[b.length - 1])
    } else {
        setOpenDIVPopup_NS(this.windowID, null)
    }
    if (this.mModal) {
        weEnableStuff(this.windowID)
    }
};
DIVPopup.prototype.ShowPopup = function(C, g, f, k) {
    var v = this.mW,
    E = this.mH;
    var D = this.mDiv.childNodes[0];
    if (v == 0) {
        v = D.offsetWidth
    }
    if (E == 0) {
        E = D.offsetHeight
    }
    if (this.mResizable) {
        var p = D.className;
        if (p.indexOf("ResizablePopup") == -1) {
            D.className = p + " ResizablePopup"
        }
    }
    if (this.mModal) {
        weDisableStuff(this.windowID)
    }
    this.mDiv.style.zIndex = nextZIndex++;
    setOpenDIVPopup_NS(this.windowID, this);
    var H = document.body.scrollTop;
    var o = window.innerHeight + H;
    var J = ComputeElementPosition(C, document.body, g, f);
    var u = J.x,
    s = J.y;
    s = (s < H ? H: s);
    s = (s + E >= o ? o - E: s);
    s = (s < 0 ? 0 : s);
    var b = document.body.scrollLeft;
    var I = window.innerWidth + b;
    u = (u < b ? b: u);
    u = (u + v >= I ? I - v: u);
    u = (u < 0 ? 0 : u);
    this.mDiv.style.left = this.mX = u;
    this.mDiv.style.top = this.mY = s;
    var B = Math.max(u + v - I, 0);
    var d = Math.max(s + E - o, 0);
    if (k && (typeof AnimMgr != "undefined") && B <= 0 && d <= 0) {
        AnimMgr.ZoomOut(C, this, u, s, v, E)
    } else {
        this.mDiv.style.width = v;
        this.mDiv.style.height = E;
        var q = this.windowID;
        setTimeout(function() {
            DIVPopup.InitFocus(q)
        },
        20)
    }
    this.mDiv.style.visibility = "inherit";
    this.mDiv.style.overflow = "hidden";
    this.mTabStops = [];
    this.ComputeTabStops(this.mDiv);
    if (B > 0 || d > 0) {
        if (weAmPopup(window.name)) {
            if (B > 0) {
                var A = getOpenDIVPopup_NS(this.windowID).mDiv.offsetWidth;
                window.weOpener.getOpenDIVPopup_NS(weGetDialogueParentID()).mDiv.style.width = A + B
            }
            if (d > 0) {
                var G = getOpenDIVPopup_NS(this.windowID).mDiv.offsetHeight;
                window.weOpener.getOpenDIVPopup_NS(weGetDialogueParentID()).mDiv.style.height = G + d
            }
        } else {
            window.resizeBy(B, d)
        }
    }
    this.InstantiateDragandResize()
};
DIVPopup.prototype.ComputeTabStops = function(d) {
    if ("getAttribute" in d && d.getAttribute("artb")) {
        this.mTabStops.push(d)
    }
    if (d.childNodes && d.childNodes.length > 0) {
        for (var b = 0; b < d.childNodes.length; b++) {
            this.ComputeTabStops(d.childNodes[b])
        }
    }
};
DIVPopup.prototype.SetSize = function(b, d) {
    this.mW = b;
    this.mH = d
};
DIVPopup.prototype.ShowCentredPopup = function(b) {
    var d = this.GetPosition();
    return this.ShowPopup(document.body, d.x, d.y, b)
};
DIVPopup.prototype.GetPosition = function() {
    var o = document.body.scrollTop;
    var g = document.body.scrollLeft;
    var f = window.innerHeight + o;
    var p = window.innerWidth + g;
    var d = this.mW / 2,
    k = this.mH / 2;
    if (d == 0) {
        d = Math.floor(this.mDiv.firstChild.offsetWidth / 2)
    }
    if (k == 0) {
        k = Math.floor(this.mDiv.firstChild.offsetHeight / 2)
    }
    var b = g + (p - g) / 2 - d;
    var q = o + (f - o) / 2 - k;
    return {
        x: b,
        y: q
    }
};
DIVPopup.prototype.SetFocus = function() {};
DIVPopup.prototype.Buttons = [{
    t: getLocalizedMessage("OK"),
    f: "OnOK",
    id: "ardivpok"
},
{
    t: getLocalizedMessage("Cancel"),
    f: "OnCancel",
    id: "ardivpcancel"
}];
DIVPopup.prototype.CloseButton = [{
    t: getLocalizedMessage("Close"),
    f: "OnCancel",
    id: "ardivcl"
}];
DIVPopup.prototype.ButtonSpacing = 5;
DIVPopup.prototype.WriteModalButtons = function() {
    var f = [];
    f.push("<tr><td align=center class=DIVPopupButtons>");
    f.push("<table><tr>");
    for (var d in this.Buttons) {
        var b = this.Buttons[d].w;
        f.push('<td width="' + b + '" height="29">');
        f.push('<button artb=1 divbtn=1 tabindex = 0 id="' + this.Buttons[d].id + '" onclick="if (getOpenDIVPopup_NS(\'' + this.windowID + "')) getOpenDIVPopup_NS('" + this.windowID + "')." + this.Buttons[d].f + '();" class="btn3d" style="position:relative; left:0; height:19; top:0; "');
        f.push(">");
        f.push('<div class="btntextdiv f1" style="position:relative; vertical-align:top; left:0; height:19;">&nbsp;&nbsp;');
        f.push(this.Buttons[d].t + "&nbsp;&nbsp;</div>");
        f.push('</td><td width="' + this.ButtonSpacing + '" height="19">&nbsp;</td>')
    }
    f.push('</tr><tr><td height="10"></td></tr></table></td></tr>');
    return f.join("")
};
DIVPopup.prototype.SetFocusToButton = function(b) {
    var d = document.getElementById(b);
    if (d != null) {
        d.focus()
    }
};
DIVPopup.prototype.OnOK = function() {
    this.HidePopup(true)
};
DIVPopup.prototype.OnCancel = function() {
    this.HidePopup(true)
};
DIVPopup.prototype.PopupBodyStyle = "DIVPopupBody";
DIVPopup.prototype.PopupStyle = "DIVPopup";
DIVPopup.prototype.GetTitleBarHTML = function(d) {
    var h = "DIVPopupTitleBar";
    var k = "title";
    if (this.mDraggable) {
        h += " DIVDraggable";
        if (this.mField != null) {
            if (this.mField.mID != 0) {
                k += this.mField.mID
            } else {
                k += this.mField.mInputNode.id
            }
        }
    }
    k = k + "_" + this.windowID;
    var g = '<tr class="' + h + "\"><td id='" + k + '\' align=left nowrap><div class="title">';
    g += (d.HTMLEncode() + "&nbsp;&nbsp;&nbsp;");
    g += "</div>";
    for (var f in this.CloseButton) {
        var b = "Close  right";
        g += '<button class="' + b + '" id="' + this.CloseButton[f].id + '" onclick="if (getOpenDIVPopup_NS(\'' + this.windowID + "')) getOpenDIVPopup_NS('" + this.windowID + "')." + this.CloseButton[f].f + '();">'
    }
    return g + "</button></td></tr>"
};
DIVPopup.prototype.GetDragHandlerHTML = function() {
    return "<DIV class='DraggableTitleBar DIVDraggable' id='title_" + this.windowID + "'><img style='width:100%;height:100%' src='" + RelContextPath + "resources/images/transparent.gif'></DIV>"
};
DIVPopup.prototype.SetContents = function(f, g) {
    this.CreateDIV();
    var d = "DIVPopup";
    if (this.mW > 0) {
        d += " ResizablePopup"
    }
    var h = '<table id="DivTable" class=\'' + d + "' cellspacing=0 cellpadding=0>";
    if (this.mTitleBar) {
        h += this.GetTitleBarHTML(f)
    }
    h += '<tr><td class="' + this.PopupBodyStyle + '">' + g + "</td></tr>";
    if (this.mShowBtn) {
        h += this.WriteModalButtons()
    }
    h += "</table>";
    if (this.mResizable) {
        var k = "handle";
        if (this.mField != null) {
            if (this.mField.mID != 0) {
                k += this.mField.mID
            } else {
                k += this.mField.mInputNode.id
            }
        }
        k += "_" + this.windowID;
        var b = "ResizeHandle  right";
        h += '<DIV class="' + b + "\" id='";
        h += k;
        h += "'></DIV>"
    }
    if (!this.mTitleBar && this.mDraggable) {
        h += this.GetDragHandlerHTML()
    }
    this.mDiv.innerHTML = h
};
DIVPopup.prototype.CreateDIV = function() {
    if (!this.mDiv) {
        var f = document.createElement("DIV");
        var d = "popup";
        if (this.mField != null) {
            var g = this.mField.mID;
            if (g == 0) {
                g = this.mField.mInputNode.id
            }
            g = g + "_" + this.windowID;
            d += g
        } else {
            d += "_" + this.windowID
        }
        f.id = d;
        var b = this.PopupStyle;
        if (!this.mTitleBar) {
            b += " transparent"
        }
        f.className = b;
        f.style.top = this.mY;
        f.style.left = this.mX;
        f.style.zIndex = nextZIndex++;
        document.body.appendChild(f);
        this.mDiv = f;
        this.mDiv.setAttribute("arwindowid", this.windowID)
    }
};
DIVPopup.InitFocus = function(b) {
    if (getOpenDIVPopup_NS(b)) {
        getOpenDIVPopup_NS(b).InitFocus()
    }
};
DIVPopup.prototype.InitFocus = function() {
    return
};
DIVPopup.prototype.DoTab = function(d, g) {
    var b = 0;
    var f = d.element;
    if (f && f.getAttribute("artb")) {
        for (var h = 0; h < this.mTabStops.length; h++) {
            if (this.mTabStops[h] == d.element) {
                b = h + (g ? 1 : -1);
                if (b >= this.mTabStops.length) {
                    b = 0
                } else {
                    if (b < 0) {
                        b = this.mTabStops.length - 1
                    }
                }
            }
        }
        if (b in this.mTabStops) {
            gFocusItem = this.mTabStops[b];
            setTimeout("doFocus()", 100)
        }
    }
};
function doFocus() {
    try {
        if (gFocusItem != null) {
            gFocusItem.focus();
            gFocusItem = null
        }
    } catch(b) {
        alert("Error in doFocus()")
    }
}
DIVPopup.prototype.SetOrigin = function(b) {
    this.mOrigin = b
};
DIVPopup.prototype.InstantiateDragandResize = function() {
    var g = "popup";
    var d = "handle";
    var h = "title";
    if (this.mField != null) {
        var k = this.mField.mID;
        if (k == 0) {
            k = this.mField.mInputNode.id
        }
        k = k + "_" + this.windowID;
        g += k;
        d += k;
        h += k
    } else {
        g += "_" + this.windowID;
        d += "_" + this.windowID;
        h += "_" + this.windowID
    }
    if (this.mDiv.id != g) {
        this.mDiv.id = g
    }
    var b = null;
    if (this.mDraggable) {
        b = new PopUpDrag(this, g, "paneldrag");
        b.addInvalidHandleId(d);
        b.setOuterHandleElId(h);
        b.startDrag = function() {
            var p = DIVPopup.FindPopup(this.mDIVPopup.windowID, this.getEl());
            var o = document.getElementById(this.handleElId);
            if (o != null && o.className.indexOf("DraggableTitleBar") != -1) {
                o.style.height = 30
            }
            if (p) {
                p.SetFocus()
            }
        };
        b.endDrag = function() {
            var o = document.getElementById(this.handleElId);
            if (o != null && o.className.indexOf("DraggableTitleBar") != -1) {
                o.style.height = 5
            }
        }
    }
    var f = new PopupResize(this, g, d, "panelresize");
    if (this.mDraggable) {
        f.popupDrag = b;
        ddGlobal = b
    }
};
AlertPopup.prototype = new DIVPopup();
AlertPopup.prototype.constructor = AlertPopup;
AlertPopup.superclass = DIVPopup.prototype;
AlertPopup.prototype.Buttons = [{
    t: getLocalizedMessage("OK"),
    w: 50,
    f: "OnOK",
    id: "ardivpok"
},
];
function AlertPopup(b) {
    AlertPopup.superclass.init.call(this, b, true, true, false, false, true)
}
function ShowAlertPopup(b, f, k) {
    var h = new AlertPopup(b);
    var d = '<P><TABLE><TR><TD><textarea id="aralertpopmsg" readonly rows=4 cols=50 class="dat" style="overflow:auto;">{0}</textarea></TD></TR></TABLE><P>'.replaceArgs(f);
    h.SetContents(k, d);
    h.ShowCentredPopup(false);
    h.SetFocusToButton(h.Buttons[0].id);
    if ("external" in top) {
        try {
            top.external.ShowAlertPopup()
        } catch(g) {}
    }
}
PopupResize = function(f, h, d, b, g) {
    PopupResize.superclass.constructor.call(this, h, b, g);
    this.mDIVPopup = f;
    if (d) {
        this.setHandleElId(d)
    }
};
YAHOO.extend(PopupResize, YAHOO.util.DragDrop, {
    _oldHeight: 0,
    _newHeight: 0,
    _oldWidth: 0,
    _newWidth: 0,
    _minX: 200,
    _minY: 200,
    onMouseDown: function(d) {
        var b = this.getEl();
        this.startWidth = b.offsetWidth;
        this.startHeight = b.offsetHeight;
        this.startPos = [YAHOO.util.Event.getPageX(d), YAHOO.util.Event.getPageY(d)];
        var f = document.getElementById(this.handleElId);
        if (f != null && f.className.indexOf("ResizeHandle") != -1) {
            f.style.height = 100;
            f.style.width = 100
        }
    },
    onDrag: function(g) {
        var f = [YAHOO.util.Event.getPageX(g), YAHOO.util.Event.getPageY(g)];
        var b = f[0] - this.startPos[0];
        var h = f[1] - this.startPos[1];
        this._newWidth = Math.max(this.startWidth + b, 10);
        this._newHeight = Math.max(this.startHeight + h, 10);
        if (this._newWidth < this._minX) {
            this._newWidth = this._minX
        }
        if (this._newHeight < this._minY) {
            this._newHeight = this._minY
        }
        var d = this.getEl();
        if (this._oldWidth <= 0) {
            this._oldWidth = parseInt(d.style.width)
        }
        if (this._oldHeight <= 0) {
            this._oldHeight = parseInt(d.style.height)
        }
        d.style.width = this._newWidth + "px";
        d.style.height = this._newHeight + "px";
        hoverState.mIgnoreEvent = true
    },
    onMouseUp: function(d) {
        this.mDIVPopup.OnResize(this._oldWidth, this._newWidth, this._oldHeight, this._newHeight);
        this._oldWidth = 0;
        this._oldHeight = 0;
        this._newWidth = 0;
        this._newHeight = 0;
        var b = this.popupDrag;
        if (b != undefined) {
            b.resetConstraints();
            b.setConstraints()
        }
        var f = document.getElementById(this.handleElId);
        if (f != null && f.className.indexOf("ResizeHandle") != -1) {
            f.style.height = 10;
            f.style.width = 10
        }
        hoverState.mIgnoreEvent = false
    }
});
PopUpDrag = function(f, d, b) {
    this.mDIVPopup = f;
    PopUpDrag.superclass.constructor.call(this, d, b)
};
YAHOO.extend(PopUpDrag, YAHOO.util.DD, {
    onMouseUp: function(b) {
        this.mDIVPopup.OnEndDrag();
        PopUpDrag.superclass.onMouseUp.apply(this, arguments)
    },
    onMouseDown: function(b) {
        this.mDIVPopup.OnStartDrag();
        PopUpDrag.superclass.onMouseDown.apply(this, arguments)
    },
    init: function() {
        PopUpDrag.superclass.init.apply(this, arguments);
        this.setConstraints()
    }
});
YAHOO.util.Event.on(window, "resize",
function(b) {
    if (ddGlobal) {
        ddGlobal.setConstraints()
    }
},
this, false);
PopUpDrag.prototype.setConstraints = function() {
    var d = YAHOO.util.Dom.getRegion(document.body);
    var g = this.getEl();
    var q = YAHOO.util.Dom.getXY(g);
    var f = parseInt(g.style.width, 10);
    var p = parseInt(g.style.height, 10);
    if (f == 1) {
        f = this.mDIVPopup.mW
    }
    if (p == 1) {
        p = this.mDIVPopup.mH
    }
    var h = q[0] - d.left;
    var o = d.right - q[0] - f;
    var k = q[1] - d.top;
    var b = YAHOO.util.Dom.getDocumentHeight() - q[1] - p;
    this.setXConstraint(h, o);
    this.setYConstraint(k, b)
};
DialogPopup.prototype = new DIVPopup();
DialogPopup.prototype.constructor = DialogPopup;
DialogPopup.superclass = DIVPopup.prototype;
function DialogPopup(b, d) {
    if (arguments.length) {
        this.init(b, d)
    }
}
DialogPopup.prototype.init = function(b, d) {
    DialogPopup.superclass.init.call(this, b, true, false, true, (d ? true: false), d);
    if (!d) {
        this.PopupStyle = "DIVPopupNoBorder"
    }
};
DialogPopup.prototype.PopupBodyStyle = "DIVPopupBodyNoBorder";
DialogPopup.prototype.SetContents = function(d, h, b) {
    var g = [];
    g.push("<iframe id=");
    g.push(d);
    g.push(" style='width:100%; height:100%' src='");
    g.push(b);
    g.push("' frameBorder=0");
    if (!this.mTitleBar) {
        g.push(" allowTransparency=true")
    }
    g.push("></iframe>");
    var f = window.frames.length;
    DialogPopup.superclass.SetContents.call(this, h, g.join(""));
    this.mIFrame = window.frames[f];
    this.mIFrame.window.name = d
};
DialogPopup.prototype.OnCancel = function() {
    this.mIFrame.window.weCloseDialogue(this.mIFrame.getTopWinWindowID_NS(), {
        v: -1
    })
};
function ARDate(h, k, g, f, b, d) {
    if (arguments.length) {
        this.init(h, k, g, f, b, d)
    }
}
ARDate.prototype.year = -1;
ARDate.prototype.month = -1;
ARDate.prototype.date = -1;
ARDate.prototype.hour = 0;
ARDate.prototype.minute = 0;
ARDate.prototype.second = 0;
ARDate.prototype.day = -1;
ARDate.prototype.ampm = -1;
ARDate.prototype.era = 1;
ARDate.prototype.jera = -1;
ARDate.prototype.init = function(h, k, g, f, b, d) {
    this.year = h;
    this.month = k;
    this.date = g;
    this.hour = f;
    this.minute = b;
    this.second = d
};
ARDate.prototype.GYear = function() {
    return this.year
};
ARDate.prototype.GMonth = function() {
    return this.month
};
ARDate.MonthLabel = function(b) {
    return localeInfo.monthsLong[b]
};
ARDate.DayShort = function(b) {
    return localeInfo.daysShort[b]
};
ARDate.prototype.DayLong = function() {
    return localeInfo.daysLong[this.GDay()]
};
ARDate.prototype.GDate = function() {
    return this.date
};
ARDate.prototype.GHour = function() {
    return this.hour
};
ARDate.prototype.GMinute = function() {
    return this.minute
};
ARDate.prototype.GSecond = function() {
    return this.second
};
ARDate.prototype.GTimeOfDay = function() {
    return (this.GHour() * 3600) + (this.GMinute() * 60) + this.GSecond()
};
ARDate.prototype.GDay = function() {
    if (this.day == -1) {
        var d = new ARDate(1995, 0, 1, 0, 0, 0, 0);
        var b = d.GDays() - this.GDays();
        if (b >= 0) {
            this.day = (7 - (b % 7)) % 7
        } else {
            this.day = ( - b) % 7
        }
    }
    return this.day
};
ARDate.prototype.GAMPM = function() {
    return this.ampm
};
ARDate.prototype.GEra = function() {
    return this.era
};
ARDate.prototype.SYear = function(b) {
    this.year = b
};
ARDate.prototype.SMonth = function(b) {
    this.month = b
};
ARDate.prototype.SDate = function(b) {
    this.date = b
};
ARDate.prototype.SHour = function(b) {
    this.hour = b
};
ARDate.prototype.SMinute = function(b) {
    this.minute = b
};
ARDate.prototype.SSecond = function(b) {
    this.second = b
};
ARDate.prototype.SDay = function(b) {
    this.day = b
};
ARDate.prototype.SAMPM = function(b) {
    this.ampm = b
};
ARDate.prototype.SEra = function(b) {
    this.era = b
};
ARDate.prototype.GDays = function() {
    var d = 0;
    var f = parseInt((13 - this.month) / 12);
    var g = this.year + 4800 - f;
    var b = this.month + 12 * f - 2;
    if ((this.year < 1582) || (this.year == 1582 && this.month < 9) || (this.year == 1582 && this.month == 9 && this.date <= 4)) {
        d = this.date + parseInt((153 * b + 2) / 5) + g * 365 + parseInt(g / 4) - 32083
    } else {
        d = this.date + parseInt((153 * b + 2) / 5) + g * 365 + parseInt(g / 4) - parseInt(g / 100) + parseInt(g / 400) - 32045
    }
    return d
};
ARDate.prototype.SDays = function(h) {
    var k = 0,
    g = 0,
    q = 0,
    p = 0,
    o = 0,
    f = 0;
    if (h < 2299161) {
        q = h + 32082
    } else {
        k = h + 32044;
        g = parseInt((4 * k + 3) / 146097);
        q = k - parseInt((g * 146097) / 4)
    }
    p = parseInt((4 * q + 3) / 1461);
    o = q - parseInt((1461 * p) / 4);
    f = parseInt((5 * o + 2) / 153);
    this.year = g * 100 + p - 4800 + parseInt(f / 10);
    this.month = f + 2 - 12 * parseInt(f / 10);
    this.date = o - parseInt((153 * f + 2) / 5) + 1;
    if (this.year <= 0) {
        this.era = 0
    }
};
ARDate.prototype.GWeekNumber = function() {
    var f = 0,
    d = 0,
    h = 0;
    var g = this.GDays();
    f = (g + 31741 - (g % 7)) % 146097 % 36524 % 1461;
    d = Math.floor(f / 1460);
    h = ((f - d) % 365) + d;
    h = Math.floor(h / 7) + 1;
    return h
};
ARDate.prototype.GTimestamp = function() {
    if (this.GEra() == 0) {
        return - 1
    }
    var d = new Date(this.year, this.month, this.date, this.hour, this.minute, this.second, 0);
    if (prefTimeZone == false) {
        return (d.getTime() / 1000)
    }
    var g = d.getTimezoneOffset() * 60000;
    var f = timezoneInfo.offset;
    var h = d.valueOf();
    var b = h - g - f;
    var k = this.inDST(b / 1000);
    if (k == -1) {
        return - 1
    } else {
        if (k == 0) {
            b -= timezoneInfo.dst
        }
    }
    b += (ARDate.getTimeinMS(this.hour, this.minute, this.second) - ARDate.getTimeinMS(d.getHours(), d.getMinutes(), d.getSeconds()));
    return b / 1000
};
ARDate.prototype.STimestamp = function(d) {
    var b = new Date(d * 1000);
    this.init(b.getFullYear(), b.getMonth(), b.getDate(), b.getHours(), b.getMinutes(), b.getSeconds());
    if (prefTimeZone == true) {
        this.adjustTime(b)
    }
};
ARDate.prototype.adjustTime = function(u) {
    var b = u.getTime();
    var d = u.getTimezoneOffset() * 60000;
    var g = timezoneInfo.offset;
    var p = d + g;
    if (this.inDST(b / 1000) != 1) {
        p += timezoneInfo.dst
    }
    if (p == 0) {
        return
    }
    var q = p % 60000;
    var f = ((p - q) % 3600000) / 60000;
    if (p < 0) {
        var k = Math.ceil(p / 3600000)
    } else {
        var k = Math.floor(p / 3600000)
    }
    var o = ARDate.getDaysInMonth(this.month, this.year);
    this.second += q;
    this.minute += f;
    this.hour += k;
    if (p > 0) {
        if (this.second > 59) {
            this.second -= 60;
            this.minute++
        }
        if (this.minute > 59) {
            this.minute -= 60;
            this.hour++
        }
        if (this.hour > 23) {
            this.hour -= 24;
            this.date++;
            this.day++;
            if (this.day > 6) {
                this.day -= 7
            }
        }
        if (this.date > o) {
            this.date -= o;
            this.month++
        }
        if (this.month > 11) {
            this.month -= 12;
            this.year++
        }
    } else {
        if (this.second < 0) {
            this.second += 60;
            this.minute--
        }
        if (this.minute < 0) {
            this.minute += 60;
            this.hour--
        }
        if (this.hour < 0) {
            this.hour += 24;
            this.date--;
            this.day--;
            if (this.day < 0) {
                this.day += 7
            }
        }
        if (this.date < 0) {
            this.date += o;
            this.month--
        }
        if (this.month < 0) {
            this.month += 12;
            this.year--
        }
    }
};
ARDate.prototype.inDST = function(g) {
    if (typeof timezoneInfo.Transitions == "undefined") {
        return 1
    }
    var k = g;
    var h = timezoneInfo.Transitions;
    if (k <= h[h.length - 1]) {
        var f;
        for (f = h.length - 1; f >= 0; f--) {
            if (k >= h[f]) {
                break
            }
        }
        var d = new Date(h[f] * 1000);
        var b = new Date(h[f + 1] * 1000);
        if (timezoneInfo.hemisphere == 0) {
            return (b.getMonth() > d.getMonth() ? 0 : 1)
        } else {
            return (b.getMonth() < d.getMonth() ? 0 : 1)
        }
    }
    return 1
};
ARDate.prototype.validateDate = function(d, f) {
    if (this.year == -1 || this.month == -1 || this.date == -1) {
        return false
    }
    var b = ARDate.getDaysInMonth(this.month, this.year);
    if (this.date > b) {
        return false
    }
    if (this.hour < 12 && this.ampm == 1) {
        this.hour += 12
    } else {
        if (this.hour == 12 && this.ampm == 0) {
            this.hour = 0
        }
    }
    if (d != 13) {
        this.adjustYear()
    } else {
        this.adjustYearForDateField(f)
    }
    return true
};
ARDate.prototype.adjustYear = function() {
    if (this.jera != -1 && localeInfo.name == "ja_JP") {
        if (this.jera == 0) {
            this.year += 1925
        } else {
            if (this.jera == 1) {
                this.year += 1988
            }
        }
    } else {
        if (this.year >= 70 && this.year <= 138) {
            this.year += 1900
        } else {
            if (this.year <= 38) {
                this.year += 2000
            }
        }
    }
};
ARDate.prototype.adjustYearForDateField = function(b) {
    if (this.jera != -1 && localeInfo.name == "ja_JP") {
        if (this.jera == 0) {
            this.year += 1925
        } else {
            if (this.jera == 1) {
                this.year += 1988
            }
        }
    }
    if (this.era == 0) {
        this.year -= ((2 * this.year) - 1)
    } else {
        if (b <= 2 && this.year >= 0 && this.year <= 33) {
            this.year += 2000
        } else {
            if (b <= 2 && this.year > 33 && this.year < 100) {
                this.year += 1900
            }
        }
    }
};
ARDate.prototype.populate = function(k, p, o) {
    var g = k.length;
    var f = 0;
    var q = 1;
    for (var h = 0; h < g; h++) {
        var d = k.charAt(h);
        if (!this.validateValue(d, p[q++])) {
            return false
        }
        if (d == "y") {
            f = p[q - 1].length;
            if (o == 13 || o == 7) {
                var b = this.validateValue("G", p[q]);
                if (!b && o == 13) {
                    return false
                }
            }
            q++
        }
    }
    return this.validateDate(o, f)
};
ARDate.prototype.validateValue = function(g, h) {
    h = h.toLowerCase();
    switch (g) {
    case "y":
        var k = parseInt(parseFloat(h));
        if (isNaN(k)) {
            return false
        }
        this.SYear(k);
        return true;
    case "M":
        if (h in localeInfo.monthsShortMap) {
            this.SMonth(localeInfo.monthsShortMap[h]);
            return true
        }
        if (h in localeInfo.monthsLongMap) {
            this.SMonth(localeInfo.monthsLongMap[h]);
            return true
        }
        return false;
    case "m":
        var k = parseInt(parseFloat(h));
        if (isNaN(k)) {
            return false
        }
        k -= 1;
        if (k < 0 || k > 11) {
            return false
        }
        this.SMonth(k);
        return true;
    case "d":
        var k = parseInt(parseFloat(h));
        if (isNaN(k)) {
            return false
        }
        if (k < 0 || k > 31) {
            return false
        }
        this.SDate(k);
        return true;
    case "E":
        if (h in localeInfo.daysShortMap) {
            this.SDay(localeInfo.daysShortMap[h]);
            return true
        }
        if (h in localeInfo.daysLongMap) {
            this.SDay(localeInfo.daysLongMap[h]);
            return true
        }
        return false;
    case "a":
        if (h in localeInfo.AMPMMap) {
            this.SAMPM(localeInfo.AMPMMap[h]);
            return true
        }
        return false;
    case "z":
        if (h.length == 3 || h.indexOf("gmt") == 0) {
            return true
        }
        return false;
    case "G":
        var b = localeInfo.eras.length;
        h = h.trim(1 | 2);
        if (h.length == 0) {
            return true
        }
        for (var f = 0; f < b; f++) {
            if (h == localeInfo.eras[f].toLowerCase()) {
                this.SEra(f);
                return true
            } else {
                var k = h.replace(/\./g, "");
                var d = localeInfo.eras[f].toLowerCase().replace(/\./g, "");
                if (k == d) {
                    this.SEra(f);
                    return true
                } else {
                    if (k == "bc") {
                        this.SEra(0);
                        return true
                    }
                }
            }
        }
        if (localeInfo.name == "ja_JP") {
            b = localeInfo.jeras.length;
            for (var f = 0; f < b; f++) {
                if (h == localeInfo.jeras[f].toLowerCase()) {
                    this.jera = f;
                    return true
                }
            }
        }
        return false;
    case "h":
        var k = parseInt(parseFloat(h));
        if (isNaN(k)) {
            return false
        }
        if (h < 0 || h > 23) {
            return false
        }
        this.SHour(k);
        return true;
    case "u":
        var k = parseInt(parseFloat(h));
        if (isNaN(k)) {
            return false
        }
        if (h < 0 || h > 59) {
            return false
        }
        this.SMinute(k);
        return true;
    case "s":
        var k = parseInt(parseFloat(h));
        if (isNaN(k)) {
            return false
        }
        if (h < 0 || h > 59) {
            return false
        }
        this.SSecond(k);
        return true
    }
    return false
};
ARDate.prototype.format = function(s, u) {
    var o = "adDeEGhHiImMnNsSuUyYzZ";
    var w = false;
    var k = s.split("");
    var p = k.length;
    var A = new Array(p);
    var v = 0;
    var d = false;
    while (k[v]) {
        if (k[v] == "'") {
            if ((v + 1) < p && k[v + 1] == "'") {
                A.push("'");
                v++
            } else {
                d = !d
            }++v
        } else {
            if (!d && o.indexOf(k[v]) > -1) {
                switch (k[v]) {
                case "a":
                    this.GHour() >= 12 ? A.push(localeInfo.AMPM[1]) : A.push(localeInfo.AMPM[0]);
                    break;
                case "d":
                    A.push(this.GDate());
                    break;
                case "D":
                    A.push(ARDate.zeroPad(this.GDate()));
                    break;
                case "e":
                    A.push(localeInfo.daysShort[this.GDay()]);
                    break;
                case "E":
                    A.push(localeInfo.daysLong[this.GDay()]);
                    break;
                case "G":
                    A.push(localeInfo.eras[this.GEra()]);
                    if (this.jera != -1) {
                        A.push(" " + localeInfo.jeras[this.jera])
                    }
                    break;
                case "h":
                    var g = this.GHour();
                    if (g == 0) {
                        A.push(12)
                    } else {
                        g > 12 ? A.push(g - 12) : A.push(g)
                    }
                    break;
                case "H":
                    var g = this.GHour();
                    if (g == 0) {
                        g = 12
                    } else {
                        if (g > 12) {
                            g -= 12
                        }
                    }
                    A.push(ARDate.zeroPad(g));
                    break;
                case "i":
                    A.push(this.GHour());
                    break;
                case "I":
                    A.push(ARDate.zeroPad(this.GHour()));
                    break;
                case "m":
                    A.push(localeInfo.monthsShort[this.GMonth()]);
                    break;
                case "M":
                    A.push(localeInfo.monthsLong[this.GMonth()]);
                    break;
                case "n":
                    A.push(this.GMonth() + 1);
                    break;
                case "N":
                    A.push(ARDate.zeroPad(this.GMonth() + 1));
                    break;
                case "s":
                    A.push(this.GSecond());
                    break;
                case "S":
                    A.push(ARDate.zeroPad(this.GSecond()));
                    break;
                case "u":
                    A.push(this.GMinute());
                    break;
                case "U":
                    A.push(ARDate.zeroPad(this.GMinute()));
                    break;
                case "y":
                    w = true;
                    var y = this.GYear();
                    var f = "";
                    if (u != 13) {
                        f = (y + "").substr(2)
                    } else {
                        if (y <= 0) {
                            f = ARDate.zeroPadYear(y * ( - 1) + 1)
                        } else {
                            f = ARDate.zeroPadYear(y)
                        }
                    }
                    A.push(f);
                    break;
                case "Y":
                    w = true;
                    var y = this.GYear();
                    var f = y + "";
                    if (u == 13) {
                        if (y <= 0) {
                            f = ARDate.zeroPadYear(y * ( - 1) + 1)
                        } else {
                            f = ARDate.zeroPadYear(y)
                        }
                    }
                    A.push(f);
                    break;
                case "z":
                    if (this.inDST() == 0) {
                        A.push(tzNames[1])
                    } else {
                        A.push(tzNames[0])
                    }
                    break;
                case "Z":
                    break
                }
                v++
            } else {
                A.push(k[v++])
            }
        }
    }
    var q = new RegExp("^zh|^ja|^ko").exec(localeInfo.name);
    var b = A.join("");
    if (w && this.GYear() < 0 && s.indexOf("G") < 0) {
        b = (q) ? localeInfo.eras[0] + " " + b: b + " " + localeInfo.eras[0]
    }
    return b
};
ARDate.daysCount = function(d, b) {
    return (b >= d) ? b - d: (7 - d + b)
};
ARDate.isLeapYear = function(b) {
    return (((b % 4 == 0) && (b % 100 != 0)) || (b % 400 == 0))
};
ARDate.getTimeinMS = function(d, f, b) {
    return (d * 3600000) + (f * 60000) + (b * 1000)
};
ARDate.zeroPad = function(b) {
    return (b < 10) ? "0" + b: b
};
ARDate.zeroPadYear = function(d) {
    var b = "";
    var f = 4 - (d + "").length;
    while (f > 0) {
        b += "0";
        f--
    }
    return b + d
};
ARDate.getDaysInMonth = function(d, b) {
    if (d == 1 && ARDate.isLeapYear(b)) {
        return ARDate.daysinMonth[d] + 1
    }
    return ARDate.daysinMonth[d]
};
ARDate.daysinMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
ARDate.parseDateTime = function(h) {
    for (var f in localeInfo.parsePatterns) {
        var g = new RegExp(localeInfo.parsePatterns[f]);
        var b = g.exec(h);
        if (b != null) {
            var d = new ARDate();
            if (d.populate(localeInfo.normalizedPatterns[f], b, 7)) {
                return d
            }
        }
    }
    return ARDate.parseTime(h)
};
ARDate.parseDate = function(d) {
    var k = new RegExp("\\s*" + localeInfo.eras[0] + "\\s*");
    var b = d.replace(k, "");
    var h = b != d;
    d = b;
    for (var g in localeInfo.parseDatePatterns) {
        var f = new RegExp(localeInfo.parseDatePatterns[g]);
        var q = f.exec(d);
        if (q != null) {
            var o = localeInfo.normalizedDatePatterns[g];
            var p = new ARDate();
            if (h) {
                p.SEra(0)
            }
            if (p.populate(o, q, 13)) {
                return p
            }
        }
    }
};
ARDate.parseTime = function(d) {
    var k = false;
    var g = new Date();
    var g = new ARDate(g.getFullYear(), g.getMonth(), g.getDate(), 0, 0, 0);
    for (var h in localeInfo.parseTimePatterns) {
        var o = new RegExp(localeInfo.parseTimePatterns[h]);
        var b = o.exec(d);
        if (b != null) {
            var f = localeInfo.normalizedTimePatterns[h];
            if (g.populate(f, b, 14)) {
                return g
            } else {
                k = true
            }
        }
    }
    return null
};
ARDate.getDateObject = function(f) {
    var d = parseInt(f);
    if (d < 0) {
        d = 0
    }
    if (d > 5373120) {
        d = 5373120
    }
    var b = new ARDate();
    b.SDays(d);
    return b
};
ARDate.ARCustomDateSetup = function(g, f, d, b) {
    localeInfo.parseDatePatterns.splice(0, 0, g);
    localeInfo.normalizedDatePatterns.splice(0, 0, f);
    localeInfo.parsePatterns.splice(0, 0, g);
    localeInfo.normalizedPatterns.splice(0, 0, f);
    localeInfo.parsePatterns.splice(0, 0, d);
    localeInfo.normalizedPatterns.splice(0, 0, b)
};
ARDate.ARCustomTimeSetup = function(b, d) {
    localeInfo.parseTimePatterns.splice(0, 0, b);
    localeInfo.normalizedTimePatterns.splice(0, 0, d)
};
ARDate.ARSetDateTimeFormat = function(d, b) {
    localeInfo.dateFormatPattern = d;
    localeInfo.timeFormatPattern = b
};
SearchBarMenu.prototype = new Menu();
SearchBarMenu.prototype.constructor = SearchBarMenu;
SearchBarMenu.superclass = Menu.prototype;
function SearchBarMenu(b) {
    if (arguments.length) {
        this.init(b)
    }
}
SearchBarMenu.prototype.init = function(f) {
    var g = [];
    this.mName = getLocalizedMessage("Search Bar");
    if (getForm_NS(f.windowID).SearchBarMenuDef.length > 0) {
        g.push({
            l: getLocalizedMessage("Fields").JScriptEncode(),
            v: getForm_NS(f.windowID).SearchBarMenuDef
        })
    }
    if (getForm_NS(f.windowID).SearchBarEnumFields.length > 0) {
        g.push({
            l: getLocalizedMessage("Selection Values").JScriptEncode(),
            v: getForm_NS(f.windowID).SearchBarEnumFields
        })
    }
    var d = [];
    for (var b in getARKWValues_NS(f.windowID)) {
        d.push({
            v: "$" + getARKWValues_NS(f.windowID)[b].n + "$",
            l: getARKWValues_NS(f.windowID)[b].n
        })
    }
    d.sort(function(k, h) {
        return k.l.toLowerCase().localeCompare(h.l.toLowerCase())
    });
    g.push({
        l: getLocalizedMessage("Keywords").JScriptEncode(),
        v: d
    });
    g.push({
        l: getLocalizedMessage("Currency Codes").JScriptEncode(),
        v: currencyMenu
    });
    SearchBarMenu.superclass.init.call(this, f.windowID, g);
    this.mField = f
};
SearchBarMenu.prototype.Open = function(b) {
    return {
        n: {
            f: SearchBarMenu.superclass.Open,
            a: [b, 3, 30100, false],
            t: this
        }
    }
};
SearchBarMenu.prototype.HandleSelection = function(b) {
    this.mField.InsertAtCaret(b)
};
DSearchBar.prototype = new Field();
DSearchBar.prototype.constructor = DSearchBar;
DSearchBar.superclass = Field.prototype;
DSearchBar.prototype.Snapshot = DSearchBar.prototype.Restore = function() {};
DSearchBar.prototype.mDOMField = DSearchBar.prototype.mHaveVisualCharacteristics = true;
DOMFieldFactories.SearchBar = function(b, f, d) {
    return new DSearchBar(b, f, d)
};
function DSearchBar(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DSearchBar.prototype.mID = 1005;
DSearchBar.prototype.height = 100;
DSearchBar.buttons = [["(", ")", '"'], ["+", "-", "*", "/", "%"], ["=", "!=", "&lt;", "&gt;", "&lt=", "&gt=", "LIKE"], ["AND", "OR", "NOT"]];
function CreateAdvancedSearchBar(g) {
    var s = F(g, 1005);
    var v = s.mObj;
    var d = [];
    d.push(v.innerHTML);
    d.push("<table class=SearchBarOperators width=100%><tr height=20>");
    var u = DSearchBar.buttons;
    d.push("<td>&nbsp;</td>");
    var q = "<td class=SearchBarButtonCell>";
    var h = "<a href=javascript: style='text-align:center;position:static;width:28px;height:19px;padding-top:1px' class='btn btn3d'";
    var w = ">";
    var k = "</a></td>";
    var b = "<td>&nbsp;</td>";
    for (var p in u) {
        for (var o in u[p]) {
            d.push(q);
            d.push(h);
            d.push(w);
            d.push(u[p][o]);
            d.push(k)
        }
        d.push(b)
    }
    d.push("</tr></table>");
    d.push("<table class=SearchBarInput width=100%><tr>");
    d.push("<td width><textarea style='width:99%;height:21;' class=sr cols='' wrap=off rows=1 ");
    d.push("id=arid" + 1005);
    d.push("></textarea></td>");
    d.push("<td width=70>");
    d.push("<a href=javascript: style='position:static;height:19px;width:70px;text-align:center' class='btn btn3d menu'");
    d.push(">");
    d.push(getLocalizedMessage("Fields") + "&nbsp;<img style=border:none alt='' src='" + RelContextPath + "resources/images/menu_down.gif'></a></td></tr></table>");
    v.innerHTML = d.join("")
}
DSearchBar.prototype.DOMMouseOver = function(b) {
    return hoverState.eventMouseOver(b)
};
DSearchBar.prototype.DOMMouseMove = function(b) {
    return hoverState.eventMouseMove(b)
};
DSearchBar.prototype.DOMMouseOut = function(b) {
    return hoverState.eventMouseOut(b)
};
DSearchBar.prototype.DOMClick = function(b) {
    hoverState.clearTracking();
    if (this.GAccess() == 3) {
        return
    }
    var d = FakeButton_Find(b.element);
    if (d) {
        if (d.className.indexOf("menu") != -1) {
            if (!this.mMenu) {
                this.mMenu = new SearchBarMenu(this)
            }
            return {
                n: {
                    f: this.mMenu.Open,
                    a: [d, 3],
                    t: this.mMenu
                }
            }
        } else {
            var f = d.firstChild.data;
            if (f != '"' && f != "%") {
                f = " " + f + " "
            }
            this.InsertAtCaret(f)
        }
    }
};
DSearchBar.prototype.DOMKeyPress = function(b) {
    if (b.key == 13) {
        b.StopDefault()
    }
};
DSearchBar.prototype.GetEditor = function() {
    return this.mObj.getElementsByTagName("textarea")[0]
};
DSearchBar.prototype.SVis = function(b) {
    DSearchBar.superclass.SVis.call(this, b);
    if (getQBPane_NS(this.windowID) && getQBPane_NS(this.windowID).GVis() != b) {
        getQBPane_NS(this.windowID).SVis(b);
        FormPane.Layout(this.windowID);
        if (b == true) {
            getForm_NS(this.windowID).LastFormFID = 0
        }
    }
};
DSearchBar.prototype.VisClick = function(b) {
    this.mKeepOpen = !this.GVis();
    this.SVis(!this.GVis())
};
DSearchBar.prototype.InsertAtCaret = function(d) {
    var b = this.GetEditor();
    b.focus();
    DSearchBar.superclass.InsertAtCaret.call(this, b, d);
    new WorkflowContext(this.windowID, {
        t: FocusMgr,
        f: FocusMgr.SetFocusToField,
        a: [this.windowID, this.mID]
    })
};
DSearchBar.prototype.TracksCaret = true;
DSearchBar.prototype.Clear = function() {
    this.GetEditor().value = ""
};
DSearchBar.prototype.DoSet = DSearchBar.prototype.DoSLoadEntry = function(b) {
    this.GetEditor().value = b.toString()
};
DSearchBar.prototype.G = function() {
    var b = this.GetEditor().value;
    b = b.trim(1 | 2);
    if (b == "") {
        return Null
    }
    return new CharType(this.GetEditor().value)
};
DSearchBar.prototype.GetFocusElement = function() {
    return this.GetEditor()
};
DateKWType.prototype = new TimeType();
DateKWType.prototype.constructor = DateKWType;
DateKWType.superclass = TimeType.prototype;
function DateKWType() {
    this.init()
}
DateKWType.prototype.init = function() {
    var b = new Date().UnixTimestamp();
    var d = new TimeType(b).toString(2);
    this.mValue = new TimeType(d).toInteger()
};
DateKWType.prototype.toString = function() {
    return TimeType.getDateTimeString(this.mValue, 2)
};
TODKWType.prototype = new TODType();
TODKWType.prototype.constructor = TODKWType;
TODKWType.superclass = TODType.prototype;
function TODKWType() {
    this.init()
}
TODKWType.prototype.init = function() {
    this.mTimestamp = new Date().UnixTimestamp();
    TODKWType.superclass.init.call(this, new TimeType(this.mTimestamp).toTOD())
};
TODKWType.prototype.toInteger = function() {
    return this.mTimestamp
};
TODKWType.prototype.toDecimal = function() {
    return new IntegerType(this.toInteger()).toDecimal()
};
TODKWType.prototype.toReal = function() {
    return this.mTimestamp
};
TODKWType.prototype.toDate = function() {
    return new DateType(new TimeType(this.toInteger()).toDate())
};
TODKWType.prototype.toTOD = function() {
    return new TODType(this.mValue)
};
WeekdayKWType.prototype = new Datatype();
WeekdayKWType.prototype.constructor = WeekdayKWType;
WeekdayKWType.superclass = Datatype.prototype;
function WeekdayKWType() {
    this.init()
}
WeekdayKWType.prototype.init = function() {
    var b = new Date().UnixTimestamp();
    var d = new TimeType(b).toDate();
    this.mValue = new TimeType(d).toInteger()
};
WeekdayKWType.prototype.isNull = false;
WeekdayKWType.prototype.toInteger = function() {
    var b = new ARDate();
    b.STimestamp(this.mValue);
    return b.GDay()
};
WeekdayKWType.prototype.toDecimal = function() {
    return new IntegerType(this.toInteger()).toDecimal()
};
WeekdayKWType.prototype.toReal = function() {
    return this.toInteger()
};
WeekdayKWType.prototype.toString = function(d) {
    var b = new ARDate();
    b.STimestamp(this.mValue);
    return b.DayLong()
};
WeekdayKWType.prototype.compareValStr = function() {
    return this.toString()
};
WeekdayKWType.prototype.toPrimitive = function() {
    return this.mValue.toString()
};
WeekdayKWType.prototype.toTOD = function() {
    return new TimeType(this.mValue).toTOD()
};
WeekdayKWType.prototype.toTime = function() {
    return new TimeType(this.mValue)
};
WeekdayKWType.prototype.toDate = function() {
    return new DateType(new TimeType(this.mValue).toDate())
};
WeekdayKWType.prototype.EQ = function(b) {
    return new CharType(this.toString()).EQ(b)
};
WeekdayKWType.prototype.NE = function(b) {
    return new CharType(this.toString()).NE(b)
};
WeekdayKWType.prototype.LT = function(b) {
    return new CharType(this.toString()).LT(b)
};
WeekdayKWType.prototype.LE = function(b) {
    return new CharType(this.toString()).LE(b)
};
WeekdayKWType.prototype.GT = function(b) {
    return new CharType(this.toString()).GT(b)
};
WeekdayKWType.prototype.GE = function(b) {
    return new CharType(this.toString()).GE(b)
};
WeekdayKWType.prototype.LIKE = function(b) {
    return new CharType(this.toString()).LIKE(b)
};
DefaultKWType.prototype = new Datatype();
DefaultKWType.prototype.constructor = DefaultKWType;
DefaultKWType.superclass = Datatype.prototype;
DatatypeFactories[1] = function(b) {
    return new DefaultKWType(b)
};
function DefaultKWType(b) {
    if (arguments.length && !(typeof b == "undefined")) {
        this.init(b)
    }
}
DefaultKWType.prototype.init = function(b) {
    if (b instanceof Datatype) {
        this.mValue = b.toChar()
    } else {
        if (typeof b == "string") {
            this.mValue = b
        } else {
            this.mValue = b
        }
    }
};
DefaultKWType.prototype.type = 1;
DefaultKWType.prototype.isNull = false;
DefaultKWType.prototype.toString = function() {
    return this.mValue
};
DefaultKWType.prototype.compareValStr = function() {
    return this.toString()
};
DefaultKWType.prototype.toPrimitive = function() {
    return this.mValue
};
DAlertList.prototype = new DTable();
DAlertList.prototype.constructor = DAlertList;
DAlertList.superclass = DTable.prototype;
DOMFieldFactories.AlertList = function(b, f, d) {
    return new DAlertList(b, f, d)
};
function DAlertList(b, f, d) {
    if (arguments.length) {
        this.init(b, f, d)
    }
}
DAlertList.prototype.init = function(d, o, k) {
    DAlertList.superclass.init.call(this, d, o, k);
    if (AlertInfo.servers.length == 0) {
        AlertInfo.servers.push(ExpandServerName(d, this.mObj.getAttribute("arserver")));
        AlertInfo.schemas.push(ExpandSchemaName(d, this.mObj.getAttribute("arschema")))
    }
    this.mHasChildFields = true;
    var h = this.getHoverEvtList();
    var g = false;
    var b = null;
    for (var f = 0; f < h.length; f++) {
        idx = f;
        b = AREventFunction(d, h[f], this.mID);
        if (b != null) {
            g = true;
            break
        }
    }
    if (!g) {
        g = this.hoverEvtonChildren()
    }
    this.mHasHoverEvt = g
};
DAlertList.prototype.InstantiateUI = function() {
    DAlertList.superclass.InstantiateUI.call(this);
    if (ARPrefsGetAsNumber(24001) != 0) {
        NodeWrite(this.mFtrRObj, this.mObj.getAttribute("arautorefstr"));
        var b = this;
        setInterval(function() {
            new WorkflowContext(b.windowID, [{
                f: b.Refresh,
                t: b,
                a: [ - 1, 0, false]
            }])
        },
        ARPrefsGetAsNumber(24001) * 60 * 1000)
    }
};
DAlertList.prototype.Refresh = function(startrow, numrows, fromchunk, swc) {
    return this.RefreshTable(startrow, numrows, fromchunk,
    function(start, maxrows, dataWrapper) {
        var qual = this.mObj.getAttribute("arqual");
        eval("qual=" + qual);
        var results = [];
        for (var i = 0; i < AlertInfo.servers.length; ++i) {
            qual = ExpandQualifier(this.windowID, qual, AlertInfo.schemas[i], AlertInfo.servers[i]);
            if (ShowWaitCursor() && (typeof swc == "undefined")) {
                dataWrapper.myidx = i;
                return {
                    isFromFunctionSplit: 1,
                    c: {
                        t: this,
                        f: function() {
                            dataWrapper.req = new NDXRequest();
                            dataWrapper.req.windowID = this.windowID;
                            dataWrapper.req.AsyncBC("GetTableEntryList", this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), ARKWGetStringByIdx(this.windowID, 17), this.mID, AlertInfo.servers[i], AlertInfo.schemas[i], ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), start, maxrows, [], qual.qual, qual.fieldids, qual.fieldvals, qual.fieldtypes, qual.fieldexterns, false, [], []);
                            dataWrapper.req.showRunning();
                            weDisableStuff(this.windowID);
                            return {
                                i: 1
                            }
                        }
                    },
                    n: {
                        t: this,
                        f: function() {
                            results[dataWrapper.myidx] = dataWrapper.req.result;
                            result = this.CombineResult(results, dataWrapper.myidx);
                            dataWrapper.req.result = result;
                            return {
                                result: result
                            }
                        }
                    }
                }
            } else {
                res = new NDXGetTableEntryList(this.windowID, ARKWGetStringByIdx(this.windowID, 7), ARKWGetStringByIdx(this.windowID, 6), ARKWGetStringByIdx(this.windowID, 17), this.mID, AlertInfo.servers[i], AlertInfo.schemas[i], ((ARKWGetStringByIdx(this.windowID, 21) != null) ? ARKWGetStringByIdx(this.windowID, 21) : ""), start, maxrows, [], qual.qual, qual.fieldids, qual.fieldvals, qual.fieldtypes, qual.fieldexterns, false, [], []);
                results[i] = res.result
            }
        }
        result = this.CombineResult(results);
        return {
            result: result
        }
    },
    swc)
};
DAlertList.prototype.CombineResult = function(g, h) {
    var k = F(this.windowID, 718).mObj.dataidx;
    if (typeof h != "undefined") {
        var p = {
            f: g[h].f,
            r: [],
            idmap: {}
        };
        var b = 0;
        for (var d = 0; d < g[h].r.length; ++d) {
            var q = g[h].r[d].i + AlertInfo.servers[h];
            var o = {
                eid: g[h].r[d].i,
                aid: h,
                i: q,
                d: g[h].r[d].d,
                rc: g[h].r[d].rc
            };
            if (o != null && o.d[k] != null && o.d[k].p == "@") {
                o.d[k].p = o.d[k].v = AlertInfo.servers[h]
            }
            p.r.push(o);
            p.idmap[q] = b; ++b
        }
        p.n = b
    } else {
        var p = {
            f: g[0].f,
            r: [],
            idmap: {}
        };
        var b = 0;
        for (var f = 0; f < g.length; ++f) {
            for (var d = 0; d < g[f].r.length; ++d) {
                var q = g[f].r[d].i + AlertInfo.servers[f];
                var o = {
                    eid: g[f].r[d].i,
                    aid: f,
                    i: q,
                    d: g[f].r[d].d,
                    rc: g[f].r[d].rc
                };
                if (o != null && o.d[k] != null && o.d[k].p == "@") {
                    o.d[k].p = o.d[k].v = AlertInfo.servers[f]
                }
                p.r.push(o);
                p.idmap[q] = b; ++b
            }
        }
        p.n = b
    }
    return p
};
DAlertList.prototype.ARDrillDown = function(k, o) {
    if (!this.mObj.getAttribute("ardrill")) {
        return ExecuteWorkflow(this.windowID, 2, this.mID)
    }
    var g = this.GetRow();
    this.SetRow(k.y);
    var h = F(this.windowID, 718).G().toString();
    var f = F(this.windowID, 717).G().toString();
    var d = F(this.windowID, 716).G().toString();
    this.SetRow(g);
    if (f == "" || d == "") {
        f = DAlertList.findSchemaName(this.windowID, h);
        if (f == "" && h != "") {
            var b = h.indexOf(".");
            if (b != -1) {
                f = DAlertList.findSchemaName(this.windowID, h.substring(0, b))
            }
        }
        d = this.mResult.r[k.y].eid
    }
    return {
        n: [{
            f: function(p) {
                return OpenNonModalForm(p.windowID, 1, h, f, "", {
                    fvlist: null,
                    wMode: 4,
                    wForceClear: 1,
                    qual: {
                        qual: "4\\1\\1\\1\\2\\4\\" + d.length + "\\" + d + "\\",
                        fieldids: [],
                        fieldvals: [],
                        fieldtypes: []
                    }
                })
            },
            a: [this]
        },
        {
            f: ExecuteWorkflow,
            a: [this.windowID, 2, this.mID]
        }]
    }
};
DAlertList.findSchemaName = function(b, f) {
    for (var d = 0; d < AlertInfo.servers.length; ++d) {
        if (AlertInfo.servers[d] == f) {
            return AlertInfo.schemas[d]
        }
    }
    return ""
};
DAlertList.prototype.GetSelectedAlerts = function() {
    var d = this.GetSelectedRows();
    var f = [];
    for (var b = 0; b < AlertInfo.servers.length; ++b) {
        f[b] = []
    }
    if (d.length > 0) {
        for (var b = 0; b < d.length; ++b) {
            f[this.mResult.r[d[b]].aid].push(this.mResult.r[d[b]].eid)
        }
    }
    return f
};
DAlertList.prototype.MarkRead = function(d) {
    var f = this.GetSelectedAlerts();
    for (var b = 0; b < AlertInfo.servers.length; ++b) {
        if (f[b].length > 0) {
            new NDXMarkAlert(this.windowID, AlertInfo.servers[b], AlertInfo.schemas[b], f[b], d)
        }
    }
    return this.Refresh( - 1, 0, false)
};
DAlertList.prototype.DeleteSelected = function() {
    var d = this.GetSelectedAlerts();
    for (var b = 0; b < AlertInfo.servers.length; ++b) {
        if (d[b].length > 0) {
            new NDXDeleteEntry(this.windowID, AlertInfo.servers[b], AlertInfo.schemas[b], d[b])
        }
    }
    return this.Refresh( - 1, 0, false)
};
DAlertList.prototype.Resort = function(d, b) {
    DTable.superclass.Resort.call(this, d, b);
    return {
        n: {
            t: this,
            f: this.TriggerEventRefresh
        }
    }
};
DAlertList.prototype.GetInitialRowSortOrder = function() {
    var b = this.mObj.getAttribute("arsort");
    if (b != "") {
        DAlertList.superclass.GetInitialRowSortOrder.call(this)
    } else {
        return {
            col: -1,
            dir: 1
        }
    }
};
DAlertList.prototype.SetRowSortOrder = function(b, d) {
    if (this.mSortOrder.length >= 2 && b == this.mSortOrder[0] && d == this.mSortOrder[1]) {
        return null
    }
    if (!this.mResult) {
        return null
    }
    if (this.mSortOrder.length == 2 && b == this.mSortOrder[0] && d != this.mSortOrder[1]) {
        this.RebuildSortOrder(b, d);
        this.mResult.r.reverse()
    } else {
        this.RebuildSortOrder(b, d);
        var k = ["var ls,rs,"];
        for (var f = 0; f < this.mSortOrder.length + 2; f += 2) {
            var g = this.mSortOrder[f];
            if (f >= this.mSortOrder.length || g == -1) {
                k.push("v=l.i.localeCompare(r.i);")
            } else {
                var h = this.mSortOrder[f + 1];
                var q = this.mColFields[g].GetSorter();
                q = q.replace(/([lr])hs/g,
                function(s, u) {
                    return (((u == "l") ^ (h == 1)) ? "r": "l") + ".d[" + g + "].p"
                });
                k.push("v=" + q + ";")
            }
            if (f == this.mSortOrder.length - 2) {
                k.push("return v;")
            } else {
                k.push("if(v!=0) return v;")
            }
        }
        k = k.join("");
        CompileFunction(k, "l,r", {});
        var q = CompiledFunction;
        this.mResult.r.sort(q)
    }
    var o = {};
    var p = this.mResult.r;
    for (var f = 0; f < p.length; ++f) {
        o[p[f].i] = f
    }
    this.mResult.idmap = o
};
function ARProcessEvent(f, g, b, d) {
    this.mEventType = f;
    this.mEventData = g;
    this.mSrcWinID = b;
    this.ignore = d;
    if (typeof(d) == "undefined") {
        keyRefCnt++
    }
}
ARProcessEvent.Add = function(b, f, h, g, d) {
    window.self.getARProcessEventMIncomingQ_NS(b).push(new ARProcessEvent(f, h, g, d))
};
ARProcessEvent.InitKeywordsEtc = function(b) {
    var d = getWindowName_NS(b);
    ARKWSet(b, 34, d);
    ARKWSet(b, 35, d);
    if (AREventFunction(b, 1048576)) {
        setInterval(function() {
            var f = getARProcessEventMIncomingQ_NS(b);
            for (var k in f) {
                if (getIsInInterruptMode_NS(b)) {
                    break
                }
                if (getCurWFC_NS(b) != null) {
                    break
                }
                var g = f[k].mSrcWinID;
                var h = f[k].mEventType;
                var o = f[k].mEventData;
                var p = f[k].ignore;
                f.splice(k, 1);
                ARKWSet(b, 33, g);
                ARKWSet(b, 32, h);
                ARKWSet(b, 42, o);
                promptBar.setToClear();
                new WorkflowContext(b, {
                    f: ExecuteWorkflow,
                    a: [b, 1048576]
                });
                if (typeof(p) == "undefined") {
                    keyRefCnt--
                }
            }
        },
        200)
    }
};
ARProcessEvent.MFieldIDRE = /^F([0-9]+)$/;
ARProcessEvent.DeliverEvent = function(d, C, s, h) {
    var p = new Array();
    var g = new Array();
    var w;
    var o = getWindowName_NS(d);
    if (C == "@") {
        var q = getParentWindowID_NS(d);
        if (q != null) {
            ARProcessEvent.Add(q, s, h, o)
        } else {
            g.push({
                wobj: weGetOpener(),
                list: [weGetDialogueParentID()]
            })
        }
    } else {
        if (C == "#") {
            p = weGetChildWindows(d);
            g.push({
                wobj: window,
                list: getLogicalChildWindowIDs(d)
            })
        } else {
            if (C == "*") {
                p = weGetAllWindows();
                for (var A = 0; A < p.length; A++) {
                    var u = p[A];
                    if (u != null && f && !u.closed && "genAllLogicalChildWindowIDsInList" in u) {
                        var E = [];
                        u.genAllLogicalChildWindowIDsInList(u.getTopWinWindowID_NS(), E);
                        g.push({
                            wobj: u,
                            list: E
                        })
                    }
                }
            } else {
                if ((w = C.match(ARProcessEvent.MFieldIDRE)) != null) {
                    var b = w[1];
                    var v = getFields_NS(d);
                    if (b in v) {
                        if ("HandleEvent" in v[b]) {
                            v[b].HandleEvent(s, h)
                        }
                    }
                } else {
                    p.push(weGetWindowByName(C))
                }
            }
        }
    }
    for (var D = 0; D < p.length; D++) {
        var f = p[D];
        if (f != null && f && !f.closed && "ARProcessEvent" in f) {
            f.ARProcessEvent.Add(f.getTopWinWindowID_NS(), s, h, o)
        }
    }
    for (var B = 0; B < g.length; B++) {
        if (g[B] != null) {
            if (g[B].list != null && g[B].list.length > 0) {
                for (var y in g[B].list) {
                    var f = g[B].wobj;
                    if (f != null && f && !f.closed && "ARProcessEvent" in f) {
                        f.ARProcessEvent.Add(g[B].list[y], s, h, o)
                    }
                }
            }
        }
    }
};
SearchesMenu.prototype = new Menu();
SearchesMenu.prototype.constructor = SearchesMenu;
SearchesMenu.superclass = Menu.prototype;
function SearchesMenu(b) {
    if (arguments.length) {
        this.init(b)
    }
}
SearchesMenu.prototype.init = function(b) {
    var d = [];
    this.mName = getLocalizedMessage("Searches");
    SearchesMenu.superclass.init.call(this, b, d)
};
SearchesMenu.prototype.Open = function(p, y) {
    var o = [];
    var q = [];
    var s = [];
    var w = [];
    var d = [];
    var k = [];
    this.mMenuDef = [];
    for (var g = 0; g < getForm_NS(this.windowID).DefinedSearch.length; g++) {
        o.push({
            l: getForm_NS(this.windowID).DefinedSearch[g].l.HTMLEncode(),
            v: "SavedSearches.LoadSearch(" + this.windowID + ",getForm_NS('" + this.windowID + "').DefinedSearch[" + g + "].v, true)"
        });
        w.push({
            l: getForm_NS(this.windowID).DefinedSearch[g].l.HTMLEncode(),
            v: "SavedSearches.LoadSearch(" + this.windowID + ",getForm_NS('" + this.windowID + "').DefinedSearch[" + g + "].v, false)"
        })
    }
    var b;
    var v = getuserSearches_NS(this.windowID);
    for (b in v.Saved) {
        if (search = v.Saved[b].disable == 0) {
            var f = "SavedSearches.LoadSearch(" + this.windowID + ",getuserSearches_NS('" + this.windowID + "').Saved['" + b.EscapeQuote() + "']";
            f = f.HTMLEncode();
            q.push({
                l: b.HTMLEncode(),
                v: f + ", true)"
            });
            d.push({
                l: b.HTMLEncode(),
                v: f + ", false)"
            })
        }
    }
    for (var h in v.Recent) {
        var u = v.Recent[h].l.HTMLEncode();
        s.push({
            l: u,
            v: "SavedSearches.LoadSearch(" + this.windowID + ",getuserSearches_NS('" + this.windowID + "').Recent[" + h + "].v, true)"
        });
        k.push({
            l: u,
            v: "SavedSearches.LoadSearch(" + this.windowID + ",getuserSearches_NS('" + this.windowID + "').Recent[" + h + "].v, false)"
        })
    }
    this.mMenuDef.push({
        l: getLocalizedMessage("Run Defined").JScriptEncode(),
        v: (o.length == 0 ? "": o),
        s: (o.length == 0 ? 0 : 1)
    });
    this.mMenuDef.push({
        l: getLocalizedMessage("Run My Searches").JScriptEncode(),
        v: (q.length == 0 ? "": q),
        s: (q.length == 0 ? 0 : 1)
    });
    this.mMenuDef.push({
        l: getLocalizedMessage("Run Recent").JScriptEncode(),
        v: (s.length == 0 ? "": s),
        s: (s.length == 0 ? 0 : 1)
    });
    this.mMenuDef.push({
        l: getLocalizedMessage("Load Defined").JScriptEncode(),
        v: (w.length == 0 ? "": w),
        s: (w.length == 0 ? 0 : 1)
    });
    this.mMenuDef.push({
        l: getLocalizedMessage("Load My Searches").JScriptEncode(),
        v: (d.length == 0 ? "": d),
        s: (d.length == 0 ? 0 : 1)
    });
    this.mMenuDef.push({
        l: getLocalizedMessage("Load Recent").JScriptEncode(),
        v: (k.length == 0 ? "": k),
        s: (k.length == 0 ? 0 : 1)
    });
    this.mMenuDef.push({
        l: getLocalizedMessage("Save Search ...").JScriptEncode(),
        v: "SaveSearch",
        s: (v.lastSearch == null ? 0 : 1)
    });
    this.mMenuDef.push({
        l: getLocalizedMessage("Manage My Searches ...").JScriptEncode(),
        v: "ManageSearch",
        s: 1
    });
    return {
        n: {
            f: SearchesMenu.superclass.Open,
            t: this,
            a: [p, y, 30100, false]
        }
    }
};
SearchesMenu.prototype.HandleSelection = function(val) {
    if (val == "SaveSearch") {
        if (getCurWFC_NS(this.windowID) != null) {
            return {
                n: {
                    f: this.OpenSaveSearchPopup,
                    t: this
                }
            }
        } else {
            new WorkflowContext(this.windowID, {
                f: this.OpenSaveSearchPopup,
                t: this
            })
        }
    } else {
        if (val == "ManageSearch") {
            if (getCurWFC_NS(this.windowID) != null) {
                return {
                    n: {
                        f: this.OpenManageSearchPopup,
                        t: this
                    }
                }
            } else {
                new WorkflowContext(this.windowID, {
                    f: this.OpenManageSearchPopup,
                    t: this
                })
            }
        } else {
            if (getCurWFC_NS(this.windowID) != null) {
                return {
                    n: {
                        f: function() {
                            return eval(val)
                        },
                        a: [val]
                    }
                }
            } else {
                eval(val)
            }
        }
    }
};
SearchesMenu.prototype.OpenSaveSearchPopup = function() {
    var g = [];
    for (var d in getuserSearches_NS(this.windowID).Saved) {
        g.push(d.HTMLEncode())
    }
    var f = {};
    var b = this.windowID;
    return {
        n: {
            f: function() {
                if ("v" in f.result) {
                    var h = f.result.v;
                    if (h != null && h.length > 0) {
                        return {
                            n: {
                                f: function() {
                                    var o = ((h in getuserSearches_NS(b).Saved) ? false: true);
                                    var k = new NDXSaveSearch(b, h.toString(), ARKWGetStringByIdx(b, 7), ARKWGetStringByIdx(b, 6), getuserSearches_NS(b).lastSearch.ids, getuserSearches_NS(b).lastSearch.vals, o, false, 0, 1);
                                    if (k.GetResult()) {
                                        getuserSearches_NS(b).Saved[h] = {
                                            ids: getuserSearches_NS(b).lastSearch.ids,
                                            vals: getuserSearches_NS(b).lastSearch.vals,
                                            disable: 0
                                        };
                                        getuserSearches_NS(b).lastSearch = null
                                    }
                                }
                            },
                            c: {
                                f: function() {
                                    if (getuserSearches_NS(b).lastSearch == null) {
                                        return {
                                            c: {
                                                t: getStateMgr_NS(b),
                                                f: getStateMgr_NS(b).QueryEntry,
                                                a: [100, false]
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            },
            a: [f]
        },
        c: {
            f: function() {
                return SaveSearchPopup(b, f, g)
            }
        }
    }
};
SearchesMenu.prototype.OpenManageSearchPopup = function() {
    var f = {};
    var g = {};
    g.h = [getLocalizedMessage("Search Name"), getLocalizedMessage("State")];
    g.r = [];
    var d;
    for (d in getuserSearches_NS(this.windowID).Saved) {
        g.r.push({
            i: d,
            d: [{
                v: d
            },
            {
                v: (getuserSearches_NS(this.windowID).Saved[d].disable == 1 ? getLocalizedMessage("Disable") : getLocalizedMessage("Enable"))
            }]
        })
    }
    var b = this.windowID;
    return {
        n: {
            f: function() {
                if ("v" in f.result && f.result.v != -1) {
                    var h = [];
                    var o = {};
                    var k;
                    for (k in getuserSearches_NS(b).Saved) {
                        if (! (k in f.result.v)) {
                            h.push(k)
                        } else {
                            if (getuserSearches_NS(b).Saved[k].disable != f.result.v[k]) {
                                o[k] = f.result.v[k]
                            }
                        }
                    }
                    if (h.length > 0) {
                        var q = new NDXDeleteSearch(b, ARKWGetStringByIdx(b, 7), ARKWGetStringByIdx(b, 6), h);
                        if (q.GetResult()) {
                            for (var p = 0; p < h.length; p++) {
                                delete getuserSearches_NS(b).Saved[h[p]]
                            }
                        }
                    }
                    for (k in o) {
                        var q = new NDXSaveSearch(b, k.toString(), ARKWGetStringByIdx(b, 7), ARKWGetStringByIdx(b, 6), [], [], false, true, o[k], 1);
                        if (q.GetResult()) {
                            getuserSearches_NS(b).Saved[k].disable = o[k]
                        }
                    }
                }
            },
            a: [f]
        },
        c: {
            f: function() {
                return ManageSearchPopup(b, f, g)
            }
        }
    }
};
function SavedSearches(b) {
    this.RecentSize = b
}
SavedSearches.prototype.lastSearch = null;
SavedSearches.prototype.Saved = null;
SavedSearches.prototype.Recent = [];
SavedSearches.prototype.RecentSize;
SavedSearches.PSP = /\${1}[^\$]+\${1}/g;
SavedSearches.QBEPSP = /^\${1}[^\$]+\${1}$/g;
SavedSearches.prototype.SaveRecent = function(d, s, o, u) {
    this.lastSearch = {};
    this.lastSearch.label = "";
    this.lastSearch.ids = [];
    this.lastSearch.vals = [];
    var w = [];
    var b;
    var k = true;
    for (b in s) {
        if (b in getForm_NS(d).displayOnlyFields) {
            continue
        }
        var q = F(d, b);
        this.lastSearch.ids.push(parseInt(b));
        var A = q.GetScreenValue();
        this.lastSearch.vals.push(A);
        if (q instanceof DataField) {
            if (!k) {
                w.push(",")
            }
            k = false;
            var g = q.GLabel();
            if (g == "") {
                g = q.GName()
            }
            w.push(g);
            w.push("=");
            w.push(A)
        }
    }
    for (b in o) {
        if (b.isNumeric()) {
            this.lastSearch.ids.push(parseInt(b));
            this.lastSearch.vals.push("$" + o[b] + "$")
        }
    }
    if (u.length > 0) {
        this.lastSearch.ids.push(1005);
        this.lastSearch.vals.push(u);
        if (!k) {
            w.push(",")
        }
        w.push(u)
    }
    if (o == null) {
        w = w.join("");
        var p = w.length;
        if (p == 0) {
            w = getLocalizedMessage("<No Search Criteria>")
        } else {
            if (p > 65) {
                w = w.substr(0, 65)
            }
        }
        this.lastSearch.label = w;
        var y = false;
        for (var h = 0; h < this.Recent.length; h++) {
            if (this.Recent[h].l == w) {
                if (this.Recent[h].v.ids.length == this.lastSearch.ids.length && this.Recent[h].v.ids.toString() == this.lastSearch.ids.toString() && this.Recent[h].v.vals.toString() == this.lastSearch.vals.toString()) {
                    y = true;
                    break
                }
            }
        }
        if (!y) {
            if (this.Recent.length >= this.RecentSize) {
                this.Recent.pop()
            }
            this.Recent.splice(0, 0, {
                l: w,
                v: this.lastSearch
            });
            return true
        }
    }
    return false
};
SavedSearches.LoadSearch = function(b, d, f) {
    if (getCurWFC_NS(b) != null) {
        return {
            n: {
                f: SavedSearches.doSearch,
                a: [b, d, f]
            }
        }
    } else {
        new WorkflowContext(b, {
            f: SavedSearches.doSearch,
            a: [b, d, f]
        })
    }
};
SavedSearches.doSearch = function(b, d, g) {
    var f = {};
    f.c = {
        f: FormAction_NewSearch,
        a: [b]
    };
    f.n = {
        f: function() {
            Field_Clear(b, false);
            for (var h = 0; h < d.ids.length; h++) {
                if (d.ids[h] in getFields_NS(b)) {
                    var k = getFields_NS(b)[d.ids[h]];
                    if (d.ids[h] == 1005) {
                        k.SVis(true);
                        k.S(new CharType(d.vals[h]))
                    } else {
                        var o = d.vals[h];
                        if (o.match(SavedSearches.QBEPSP)) {
                            k.SetScreenValue(o)
                        } else {
                            var p = null;
                            p = Field.GetQBEOperator(o);
                            if (p != null) {
                                o = o.substring(p.length).trim(1)
                            }
                            o = Datatype_Factory({
                                t: 4,
                                v: o,
                                a: {}
                            });
                            k.S(o);
                            if (p != null) {
                                k.SetScreenValue(p + k.GetScreenValAsPrimitive())
                            }
                        }
                    }
                }
            }
            if (g) {
                return FormAction_Query(b)
            }
        }
    };
    return f
};
TableSettingsMenu.prototype = new Menu();
TableSettingsMenu.prototype.constructor = TableSettingsMenu;
TableSettingsMenu.superclass = Menu.prototype;
function TableSettingsMenu(b) {
    if (arguments.length) {
        this.init(b)
    }
}
TableSettingsMenu.prototype.init = function(b) {
    this.mTableObj = b;
    this.mName = getLocalizedMessage("Table Settings");
    TableSettingsMenu.superclass.init.call(this, this.mTableObj.windowID, [])
};
TableSettingsMenu.prototype.Open = function(d, b) {
    this.mMenuDef = this.BuildDefinition();
    this.mXAdjust = 1;
    this.mYAdjust = 1;
    return {
        n: {
            f: TableSettingsMenu.superclass.Open,
            t: this,
            a: [d, b, 30100, false]
        }
    }
};
TableSettingsMenu.prototype.BuildDefinition = function() {
    var d = [];
    var h = [];
    var g = [];
    var k = this.mTableObj.mColDatas;
    var o = this.mTableObj.mColInfo;
    for (var f = 0; f < k.length; f++) {
        if (!k[f].mVisible) {
            continue
        }
        if (this.mTableObj instanceof DPageArray) {
            if (k[f].mWidth == 0) {
                d.push({
                    l: o[f].heading.HTMLEncode(),
                    v: "this.showField(" + f + ")"
                })
            } else {
                h.push({
                    l: o[f].heading.HTMLEncode(),
                    v: "this.hideField(" + f + ")"
                })
            }
        } else {
            var b = "";
            if (k[f].mHeader.firstChild) {
                b = k[f].mHeader.firstChild.data.HTMLEncode()
            }
            if (k[f].mWidth == 0) {
                d.push({
                    l: b,
                    v: "this.showColumn(" + f + ")"
                })
            } else {
                h.push({
                    l: b,
                    v: "this.hideColumn(" + f + ")"
                })
            }
        }
    }
    if (this.mTableObj instanceof DPageArray) {
        g.push({
            l: getLocalizedMessage("Add Field").JScriptEncode(),
            v: (d.length == 0 ? "": d),
            s: (d.length == 0 ? 0 : 1)
        });
        g.push({
            l: getLocalizedMessage("Remove Field").JScriptEncode(),
            v: (h.length <= 1 ? "": h),
            s: (h.length <= 1 ? 0 : 1)
        })
    } else {
        g.push({
            l: getLocalizedMessage("Add Column").JScriptEncode(),
            v: (d.length == 0 ? "": d),
            s: (d.length == 0 ? 0 : 1)
        });
        g.push({
            l: getLocalizedMessage("Remove Column").JScriptEncode(),
            v: (h.length <= 1 ? "": h),
            s: (h.length <= 1 ? 0 : 1)
        })
    }
    g.push({
        l: getLocalizedMessage("Set Refresh Interval").JScriptEncode(),
        v: "this.setInterval()",
        s: 1
    });
    g.push({
        l: getLocalizedMessage("Reset").JScriptEncode(),
        v: "this.reset()",
        s: 1
    });
    g.push({
        l: getLocalizedMessage("Save").JScriptEncode(),
        v: "this.save()",
        s: (gettablePrefs_NS(this.mTableObj.windowID) == null ? 0 : 1)
    });
    return g
};
TableSettingsMenu.prototype.HandleSelection = function(val) {
    eval(val)
};
TableSettingsMenu.prototype.showField = function(b) {
    this.mTableObj.mColDatas[b].mWidth = 1;
    this.mTableObj.ApplyData()
};
TableSettingsMenu.prototype.hideField = function(b) {
    this.mTableObj.mColDatas[b].mWidth = 0;
    this.mTableObj.ApplyData()
};
TableSettingsMenu.prototype.showColumn = function(b) {
    var d = this.mTableObj.GetInitialColumnWidths();
    this.mTableObj.mColDatas[b].mWidth = (d[b] < 5 ? 5 : d[b]);
    if (!this.mTableObj.mHScroll) {
        this.mTableObj.ScaleSizes()
    }
    this.mTableObj.ApplySizes();
    this.mTableObj.UpdateScrollOffset()
};
TableSettingsMenu.prototype.hideColumn = function(b) {
    var d = this.mTableObj.mColCnt - 1;
    while (d >= 0 && (!this.mTableObj.mColDatas[d].mVisible || this.mTableObj.mColDatas[d].mWidth <= 0)) {--d
    }
    if (b == d) {
        var f = b - 1;
        while (f >= 0 && (!this.mTableObj.mColDatas[f].mVisible || this.mTableObj.mColDatas[f].mWidth <= 0)) {
            f--
        }
        this.mTableObj.mColDatas[f].mWidth += this.mTableObj.mColDatas[b].mWidth
    }
    this.mTableObj.mColDatas[b].mWidth = 0;
    this.mTableObj.ApplySizes();
    this.mTableObj.UpdateScrollOffset()
};
TableSettingsMenu.prototype.reset = function() {
    var b = 0;
    ARRegisterTableRefreshInterval(this.mTableObj.windowID, this.mTableObj, b);
    this.mTableObj.ResetColData();
    if (!this.mTableObj.mNotRefreshed) {
        new WorkflowContext(this.mTableObj.windowID, {
            t: this.mTableObj,
            f: this.mTableObj.Resort,
            a: [ - 2, 1]
        })
    }
};
TableSettingsMenu.prototype.save = function() {
    var k = [];
    var q = [];
    var d = this.mTableObj.mColDatas;
    var p = this.mTableObj.mColFields;
    for (var g = 0; g < d.length; g++) {
        k.push(p[d[g].mDataCol].mID);
        q.push(d[g].mWidth)
    }
    var f = this.mTableObj.mSortOrder;
    var b = "";
    if (f.length > 0) {
        b = (f.length / 2) + "|";
        for (var g = 0; g < f.length; g += 2) {
            b += (f[g + 1] < 0 ? "-" + p[f[g]].mID: "+" + p[f[g]].mID) + "|"
        }
    }
    var o = new NDXSaveTableSettings(this.mTableObj.windowID, ARKWGetStringByIdx(this.mTableObj.windowID, 7), ARKWGetStringByIdx(this.mTableObj.windowID, 6), ARKWGetStringByIdx(this.mTableObj.windowID, 17), this.mTableObj.mID, k, q, b, this.mTableObj.mRefreshInterval);
    var h = gettablePrefs_NS(this.mTableObj.windowID);
    if (h == null) {
        h = {};
        h.interval = []
    }
    h.interval[this.mTableObj.mID] = this.mTableObj.mRefreshInterval
};
TableSettingsMenu.prototype.setTableRefreshInterval = function() {
    var b = {};
    var d = this.mTableObj;
    return {
        n: {
            f: function() {
                if ("v" in b.result) {
                    var f = parseInt(b.result.v);
                    if (f != -1) {
                        return {
                            c: {
                                f: ARRegisterTableRefreshInterval,
                                a: [d.windowID, d, f]
                            }
                        }
                    }
                }
            },
            a: [b]
        },
        c: {
            f: function() {
                var f = d.mRefreshInterval;
                return TableRefreshPopup(d.windowID, b, f)
            }
        }
    }
};
TableSettingsMenu.prototype.setInterval = function() {
    new WorkflowContext(this.mTableObj.windowID, {
        f: this.setTableRefreshInterval,
        t: this
    })
};
TableSettingsMenu.prototype.mTableObj;
TableContextMenu.prototype = new TableSettingsMenu();
TableContextMenu.prototype.constructor = TableContextMenu;
TableContextMenu.superclass = TableSettingsMenu.prototype;
function TableContextMenu(b) {
    if (arguments.length) {
        this.init(b)
    }
}
TableContextMenu.prototype.mTableObj;
TableContextMenu.prototype.init = function(b) {
    TableContextMenu.superclass.init.call(this, b);
    this.mAnimate = false
};
TableContextMenu.prototype.Open = function(f, b, h) {
    this.mMenuDef = [];
    var d = 1;
    if (this.mTableObj.mNotRefreshed) {
        d = 0
    }
    if (this.mTableObj.mBtnRefresh != null) {
        this.mMenuDef.push({
            l: this.mTableObj.mBtnRefresh.name.JScriptEncode(),
            v: "new WorkflowContext (" + this.mTableObj.windowID + ", {f:this.mTableObj.Refresh,t:this.mTableObj,a:[-1,0,false]});",
            s: 1
        })
    }
    if (this.mTableObj.mBtnReport != null) {
        this.mMenuDef.push({
            l: this.mTableObj.mBtnReport.name.JScriptEncode(),
            v: "new WorkflowContext (" + this.mTableObj.windowID + ", {f:this.mTableObj.Report,t:this.mTableObj});",
            s: d
        })
    }
    if (this.mTableObj.mBtnSelectAll != null) {
        this.mMenuDef.push({
            l: this.mTableObj.mBtnSelectAll.name.JScriptEncode(),
            v: "new WorkflowContext (" + this.mTableObj.windowID + ", {f:this.mTableObj.SelectAll,t:this.mTableObj,a:[true]});",
            s: d
        })
    }
    if (this.mTableObj.mBtnDeselectAll != null) {
        this.mMenuDef.push({
            l: this.mTableObj.mBtnDeselectAll.name.JScriptEncode(),
            v: "new WorkflowContext (" + this.mTableObj.windowID + ", {f:this.mTableObj.SelectAll,t:this.mTableObj,a:[false]});",
            s: d
        })
    }
    if (this.mTableObj.mBtnPref != null) {
        var g = this.BuildDefinition();
        this.mMenuDef.push({
            l: this.mTableObj.mBtnPref.name.JScriptEncode(),
            v: g,
            s: 1
        })
    }
    if (this.mTableObj.mID == 1020 && this.mTableObj.mBtnDelete != null) {
        this.mMenuDef.push({
            l: this.mTableObj.mBtnDelete.name.JScriptEncode(),
            v: "new WorkflowContext (" + this.mTableObj.windowID + ", {f:this.mTableObj.DeleteSelected,t:this.mTableObj});",
            s: d
        })
    }
    this.BuildCustomContextMenu();
    this.mXAdjust = h.x;
    this.mYAdjust = h.y;
    if (this.mMenuDef.length == 0) {
        return
    }
    return {
        n: {
            f: TableSettingsMenu.superclass.Open,
            t: this,
            a: [f, b, 30100, false]
        }
    }
};
TableContextMenu.prototype.HandleSelection = function(val) {
    eval(val)
};
TableContextMenu.prototype.BuildCustomContextMenu = function() {
    var k = this.mTableObj.mID;
    var d = getARMenus_NS(this.mTableObj.windowID)["artbl" + k];
    if (typeof d == "undefined") {
        return
    }
    for (var f = 1; f < d[k].length; f++) {
        var h = F(this.mTableObj.windowID, d[k][f]);
        if (h.mID != 0 && h.GVis()) {
            var b = (h.GAccess() == 3 ? false: true);
            if (d[h.mID]) {
                var g = this.BuildSubMenu(d, d[h.mID]);
                this.mMenuDef.push({
                    l: h.mObj.lbl.JScriptEncode(),
                    v: g,
                    s: b
                })
            } else {
                this.mMenuDef.push({
                    l: h.mObj.lbl.JScriptEncode(),
                    v: "new WorkflowContext (" + h.windowID + ", {f:ARProcessActionActiveLink,a:[" + h.windowID + ",'1 " + h.mID + "']});",
                    s: b
                })
            }
        }
    }
};
TableContextMenu.prototype.BuildSubMenu = function(o, g) {
    var k = [];
    for (var f = 1; f < g.length; f++) {
        var h = F(this.mTableObj.windowID, g[f]);
        if (h.mID != 0 && h.GVis()) {
            var d = (h.GAccess() == 3 ? false: true);
            if (o[h.mID]) {
                var b = this.BuildSubMenu(o, o[h.mID]);
                k.push({
                    l: h.mObj.lbl.JScriptEncode(),
                    v: b,
                    s: d
                })
            } else {
                k.push({
                    l: h.mObj.lbl.JScriptEncode(),
                    v: "new WorkflowContext (" + h.windowID + ", {f:ARProcessActionActiveLink,a:[" + h.windowID + ",'1 " + h.mID + "']});",
                    s: d
                })
            }
        }
    }
    return k
};
TableContextMenu.prototype.doEncode = function() {
    return true
};
AttachmentContextMenu.prototype = new Menu();
AttachmentContextMenu.prototype.constructor = AttachmentContextMenu;
AttachmentContextMenu.superclass = Menu.prototype;
function AttachmentContextMenu(b) {
    this.init(b)
}
AttachmentContextMenu.prototype.mAttachObj;
AttachmentContextMenu.prototype.init = function(b) {
    this.mAttachObj = b;
    AttachmentContextMenu.superclass.init.call(this, b.windowID, []);
    this.mAnimate = false
};
AttachmentContextMenu.prototype.Open = function(f, b, g) {
    this.mMenuDef = [];
    var d = 0;
    if (this.mAttachObj.mPrimaryRowSelection != null) {
        var h = this.mAttachObj.mRowIdMap[this.mAttachObj.RowNoFromTag(this.mAttachObj.mPrimaryRowSelection)];
        if (!F(this.mAttachObj.windowID, h).mObj.v.isNull) {
            d = 1
        }
    }
    if (this.mAttachObj.mBtnAdd != null) {
        this.mMenuDef.push({
            l: this.mAttachObj.mBtnAdd.name.JScriptEncode(),
            v: "new WorkflowContext (this.mAttachObj.windowID,{f:this.mAttachObj.Add,t:this.mAttachObj,a:[[]]});",
            s: 1
        })
    }
    if (this.mAttachObj.mBtnDelete != null) {
        this.mMenuDef.push({
            l: this.mAttachObj.mBtnDelete.name.JScriptEncode(),
            v: "new WorkflowContext (this.mAttachObj.windowID,{f:this.mAttachObj.UIDelete,t:this.mAttachObj});",
            s: d
        })
    }
    if (this.mAttachObj.mBtnDisplay != null) {
        this.mMenuDef.push({
            l: this.mAttachObj.mBtnDisplay.name.JScriptEncode(),
            v: "new WorkflowContext (this.mAttachObj.windowID,{f:this.mAttachObj.UIDisplay,t:this.mAttachObj});",
            s: d
        })
    }
    if (this.mAttachObj.mBtnSave != null) {
        this.mMenuDef.push({
            l: this.mAttachObj.mBtnSave.name.JScriptEncode(),
            v: "new WorkflowContext (this.mAttachObj.windowID,{f:this.mAttachObj.UISaveToDisk,t:this.mAttachObj});",
            s: d
        })
    }
    if (this.mAttachObj.mBtnDeselect != null) {
        this.mMenuDef.push({
            l: this.mAttachObj.mBtnDeselect.name.JScriptEncode(),
            v: "new WorkflowContext (this.mAttachObj.windowID,{f:this.mAttachObj.UIDeselect,t:this.mAttachObj});",
            s: 1
        })
    }
    this.mXAdjust = g.x;
    this.mYAdjust = g.y;
    return {
        n: {
            f: AttachmentContextMenu.superclass.Open,
            t: this,
            a: [f, b, 30100, false]
        }
    }
};
AttachmentContextMenu.prototype.HandleSelection = function(val) {
    eval(val)
};
var promptBar = null;
function PromptBar(b, d) {
    this.init(b, d)
}
PromptBar.prototype.init = function(b, d) {
    this.windowID = b;
    this.mNumDisplayedMessages = 0;
    this.MAX_HEIGHT = d.offsetHeight;
    this.initialshow = true;
    this.initialshowsize = 2;
    this.mTableElem = d.firstChild;
    this.mMsgAlt = new Array(3);
    this.mMsgAlt[0] = getLocalizedMessage("Prompt Information");
    this.mMsgAlt[1] = getLocalizedMessage("Prompt Warning");
    this.mMsgAlt[2] = getLocalizedMessage("Prompt Error");
    this.mCloseAlt = getLocalizedMessage("Prompt Close");
    this.mSystemPromptType = getsysMsgPromptType_NS(b);
    this.mClearOnFirstMessage = null
};
PromptBar.prototype.getVisibleHeight = function() {
    return getPromptBarPane_NS(this.windowID).getHeight()
};
PromptBar.prototype.getWidth = function() {
    return window.innerWidth
};
PromptBar.prototype.getPromptDOMObj = function() {
    return getFormElements_NS(this.windowID)["PromptBar"]
};
PromptBar.prototype.visibility = function() {
    return getPromptBarPane_NS(this.windowID).GVis()
};
PromptBar.prototype.getPromptTable = function() {
    return this.mTableElem
};
PromptBar.prototype.getInitialHeight = function() {
    return this.initialHeight
};
PromptBar.prototype.getTableHeight = function() {
    var d = this.mTableElem.parentNode;
    var b = this.mTableElem.scrollHeight;
    var g = (document.defaultView.getComputedStyle(d, null).getPropertyValue("padding-top"));
    if (!isNaN(parseInt(g))) {
        b += parseInt(g)
    }
    var f = (document.defaultView.getComputedStyle(d, null).getPropertyValue("padding-bottom"));
    if (!isNaN(parseInt(f))) {
        b += parseInt(f)
    }
    return b
};
PromptBar.prototype.hideNewMessages = function() {
    var b = this.getPromptDOMObj();
    if (b.style.overflow == "auto") {
        b.style.overflow = "hidden"
    }
};
PromptBar.prototype.newPromptSize = function() {
    var b = this.getTableHeight();
    if (b >= this.MAX_HEIGHT) {
        b = this.MAX_HEIGHT
    }
    return b
};
PromptBar.prototype.hide = function(b) {
    if (this.visibility()) {
        this.deleteAllMessages();
        this.hidePromptbarInternal(b)
    }
};
PromptBar.prototype.hidePromptbarInternal = function(d) {
    var b = this.getPromptDOMObj();
    if (b != null) {
        var f = 0;
        var g = this.getWidth();
        if (typeof AnimMgr != "undefined" && d) {
            AnimMgr.shrinkPromptBar(b, f, g, PromptBar.prototype.hide2Promptbar, promptBar, this.windowID)
        } else {
            this.hide2Promptbar()
        }
    }
};
PromptBar.prototype.hide2Promptbar = function() {
    getPromptBarPane_NS(this.windowID).SVis(false);
    FormPane.Layout(this.windowID);
    getPromptBarPane_NS(this.windowID).changeHeight(this.getInitialHeight())
};
PromptBar.prototype.show = function() {
    var d = this.newPromptSize();
    var b = this.getPromptDOMObj();
    if (this.visibility()) {
        if (d >= promptBar.MAX_HEIGHT) {
            b.style.overflow = "auto";
            b.scrollTop = promptBar.getTableHeight()
        } else {
            this.showWithAnimation(false)
        }
    } else {
        this.showWithAnimation(true)
    }
};
PromptBar.prototype.showWithAnimation = function(d) {
    var g = this.newPromptSize();
    getPromptBarPane_NS(this.windowID).changeHeight(g);
    getPromptBarPane_NS(this.windowID).SVis(true);
    FormPane.Layout(this.windowID);
    var b = this.getPromptDOMObj();
    if (b != null) {
        var f = g;
        var h = this.getWidth();
        if (typeof AnimMgr != "undefined" && d) {
            AnimMgr.growPromptBar(b, f, h, PromptBar.prototype.show2WithAnimation, promptBar, true, this.windowID)
        } else {
            this.show2WithAnimation(false)
        }
    }
};
PromptBar.prototype.show2WithAnimation = function(f) {
    var d = this.newPromptSize();
    if (f) {
        getPromptBarPane_NS(this.windowID).changeHeight(d);
        getPromptBarPane_NS(this.windowID).SVis(true);
        FormPane.Layout(this.windowID)
    }
    var b = this.getPromptDOMObj();
    if (d >= this.MAX_HEIGHT) {
        b.style.overflow = "auto";
        b.scrollTop = this.getTableHeight()
    } else {
        b.style.overflow = "hidden"
    }
};
PromptBar.prototype.getSystemPromptType = function() {
    return this.mSystemPromptType
};
PromptBar.prototype.msgContext = function() {
    var b = 0;
    if ((getARStateCurrent_NS(this.windowID) == 2)) {
        b = 1
    } else {
        if (formModalList.PanelDialogVisible()) {
            b = 1
        }
    }
    return b
};
PromptBar.prototype.redirectAtRuntime = function(f) {
    var b = f;
    if (b == 0) {
        if (this.msgContext() == 1) {
            b = 1
        }
        var d = getCurrentWindowID_NS();
        if (getStateMgr_NS(d).mWindowIsClosed && getCurrentWindowID_NS() == getTopWinWindowID_NS()) {
            b = 1
        }
    }
    return b
};
PromptBar.prototype.buildMsgforPrompt = function(b, d) {
    return WorkflowContext_StatusToString(b, [d])
};
PromptBar.prototype.ARTypetoPromptType = function(b) {
    switch (b) {
    case 0:
        return 0;
        break;
    case 1:
        return 1;
        break;
    case 2:
        return 2;
        break
    }
};
PromptBar.prototype.msgTypeToSysMsgDest = function(b) {
    var d = 0;
    switch (b) {
    case 0:
        if (this.mSystemPromptType == 2) {
            d = 1
        }
        break;
    case 1:
        if (this.mSystemPromptType == 2) {
            d = 1
        }
        break;
    case 2:
        if (this.mSystemPromptType == 2 || this.mSystemPromptType == 0) {
            d = 1
        }
        break
    }
    return d
};
PromptBar.prototype.msgDestination = function(b, f, g) {
    if (f) {
        return g
    } else {
        var d = this.ARTypetoPromptType(b);
        return this.msgTypeToSysMsgDest(d)
    }
};
PromptBar.prototype.getIconClass = function(b) {
    switch (b) {
    case 0:
        return "promptimg promptimginf";
        break;
    case 1:
        return "promptimg promptimgwar";
        break;
    case 2:
        return "promptimg promptimgerr";
        break
    }
};
PromptBar.prototype.createImgCell = function(f, g, b) {
    var d = f.insertCell(g);
    d.className = this.getIconClass(b);
    d.title = this.mMsgAlt[b];
    d.innerHTML = "&nbsp;"
};
PromptBar.prototype.getTextClass = function(b) {
    switch (b) {
    case 0:
        return "prompttext prompttextinf";
        break;
    case 1:
        return "prompttext prompttextwar";
        break;
    case 2:
        return "prompttext prompttexterr";
        break
    }
};
PromptBar.prototype.createMsgCell = function(f, g, b, d) {
    var h = f.insertCell(g);
    h.className = this.getTextClass(b);
    h.innerHTML = d.HTMLEncode()
};
PromptBar.prototype.createCloseCell = function(d, f, g) {
    var b = d.insertCell(f);
    if (!g) {
        b.className = "promptclosecommon promptclose";
        b.innerHTML = "&nbsp;"
    } else {
        b.className = "promptclosecommon promptcloseimg";
        b.innerHTML = "&nbsp;";
        b.title = this.mCloseAlt
    }
};
PromptBar.prototype.addRowSep = function(f, g) {
    for (var d = 0; d < g; d++) {
        var b = f.insertCell(d);
        b.className = "promptrowspace"
    }
};
PromptBar.prototype.sendMsgAutomation = function(b, d) {
    if ("external" in top) {
        try {
            top.external.showPromptMsg(b, d)
        } catch(f) {}
    }
};
PromptBar.prototype.addMessage = function(b, d) {
    var g = this.mTableElem.insertRow( - 1);
    if (g != null) {
        var h = 0;
        this.createImgCell(g, h, b);
        h++;
        this.createMsgCell(g, h, b, d);
        h++;
        this.createCloseCell(g, h, (this.mNumDisplayedMessages == 0));
        var f = this.mTableElem.insertRow( - 1);
        this.addRowSep(f, h + 1);
        this.mNumDisplayedMessages++;
        this.sendMsgAutomation(b, d)
    }
    return this.mNumDisplayedMessages
};
PromptBar.prototype.showMessage = function(b, d) {
    if (this.initialshow) {
        getPromptBarPane_NS(this.windowID).changeHeight(this.initialshowsize);
        getPromptBarPane_NS(this.windowID).SVis(true);
        FormPane.Layout(this.windowID);
        getPromptBarPane_NS(this.windowID).SVis(false);
        this.initialshow = false
    }
    if (this.mClearOnFirstMessage) {
        if (this.visibility()) {
            this.hide(false)
        }
        this.mClearOnFirstMessage = false
    }
    if (this.visibility()) {
        this.hideNewMessages()
    }
    this.addMessage(b, d)
};
PromptBar.prototype.showAllMessages = function() {
    if (this.mNumDisplayedMessages > 0) {
        this.show()
    }
};
PromptBar.prototype.deleteTableRow = function(b) {
    this.mTableElem.deleteRow(b)
};
PromptBar.prototype.deleteAllMessages = function() {
    var d = this.mTableElem.rows.length - 1;
    for (var b = d; b > 0; b = b - 2) {
        this.deleteTableRow(b);
        this.deleteTableRow(b - 1);
        this.mNumDisplayedMessages--
    }
};
PromptBar.prototype.setToClear = function() {
    this.mClearOnFirstMessage = true
};
PromptBar.prototype.Resize = function(g, d) {
    if (resizeWindow) {
        var b = this.getTableHeight();
        if (b > d) {
            var f = this.getPromptDOMObj();
            f.style.overflow = "auto"
        }
    }
};
PromptBar.prototype.DOMClick = function(b) {
    if (b.element.className.indexOf("promptcloseimg") != -1) {
        this.hide(true)
    }
    return false
};
PromptBar.prototype.DOMMouseOver = function(b) {
    if (b.element.className.indexOf("promptcloseimg") != -1) {
        b.element.className = "promptclosecommon promptcloseimgro"
    }
    return true
};
PromptBar.prototype.DOMMouseOut = function(b) {
    if (b.element.className.indexOf("promptcloseimg") != -1) {
        b.element.className = "promptclosecommon promptcloseimg"
    }
    return true
};
function promptAVisible() {
    return promptBar.visibility()
}
function promptAGetTable() {
    return promptBar.getPromptTable()
}
function SaveSearchPopup(b, g, f) {
    var k = getLocalizedMessage("Save or Redefine Search");
    var d = getLocalizedMessage("Search Name");
    var h = getLocalizedMessage("Enter a new name, or select a saved search to redefine");
    return weOpenModalPopup(b, (AbsContextPath + "resources/html/SaveSearchPopup.html"), "SaveSearch", {
        title: k,
        appss: GetAppStyleSheet("../../"),
        label: d,
        name: name,
        menu: f,
        desc: h,
        prefs: PREFS
    },
    g, [400, 175])
}
function ManageSearchPopup(b, d, f) {
    var g = getLocalizedMessage("Manage Search");
    return weOpenModalPopup(b, (AbsContextPath + "resources/html/ManageSearchPopup.html"), "ManageSearch", {
        title: g,
        appss: GetAppStyleSheet("../../"),
        l: f
    },
    d, [400, 250])
}
function ParamSearchPopup(d, h, k) {
    var f = getLocalizedMessage("Enter Search Values");
    var o = getLocalizedMessage("Parameterized Search");
    var g = 0;
    for (var p in k) {
        g++
    }
    var b = (g * 25) + 125;
    return weOpenModalPopup(d, (AbsContextPath + "resources/html/ParamSearchPopup.html"), "ParameterizedSearch", {
        appss: GetAppStyleSheet("../../"),
        title: o,
        label: f,
        fl: k
    },
    h, [500, b])
}
function TableRefreshPopup(b, g, d) {
    var k = getLocalizedMessage("Table Refresh Interval");
    var f = getLocalizedMessage("Refresh Interval (minutes)");
    var h = getLocalizedMessage("Enter the interval at which the table should automatically refresh. Enter 0 to clear the interval.");
    return weOpenModalPopup(b, (AbsContextPath + "resources/html/TableRefreshPopup.html"), "TableRefreshInterval", {
        title: k,
        appss: GetAppStyleSheet("../../"),
        label: f,
        desc: h,
        interval: d
    },
    g, [380, 150])
}
function actb(acField) {
    var obj = acField.mInputNode;
    this.SUGGESTION_SIZE = 10;
    this.showAll = true;
    this.actb_timeOut = -1;
    this.actb_lim = 10;
    this.actb_firstText = true;
    this.actb_mouse = true;
    this.acField = acField;
    acField.mInputNode.acField = acField;
    this.actb_completionListener = null;
    this.actb_delimiter = new Array();
    this.actb_startcheck = 1;
    this.actb_hStyle = "text-decoration:underline";
    this.actb_zIndex = "99999";
    var actb_delimwords = new Array();
    var actb_cdelimword = 0;
    var actb_delimchar = new Array();
    var actb_display = false;
    var actb_pos = -1;
    var actb_total = 0;
    var actb_curr = null;
    var actb_rangeu = 0;
    var actb_ranged = 0;
    var actb_bool = new Array();
    var actb_pre = 0;
    var actb_toid;
    var actb_tomake = false;
    var actb_getpre = "";
    var actb_mouse_on_list = 0;
    var actb_kwcount = 0;
    var actb_caretmove = false;
    var actb_parent = getFormElements_NS(acField.windowID)["FormContainer"];
    this.actb_keywords = new Array();
    this.actb_lengths = new Array();
    this.actb_values = new Array();
    var actb_self = this;
    actb_curr = obj;
    if (!this.acField.acdirtyfocus) {
        actb_addEvent(actb_curr, "focus", actb_setup)
    }
    function actb_setup() {
        actb_addEvent(document, "keydown", actb_checkkey);
        actb_addEvent(actb_curr, "blur", actb_clear);
        actb_addEvent(document, "keypress", actb_keypress);
        actb_addEvent(document, "mousedown", actb_mousedown)
    }
    function actb_clear(evt) {
        if (!evt) {
            evt = event
        }
        actb_removeEvent(document, "keydown", actb_checkkey);
        actb_removeEvent(actb_curr, "blur", actb_clear);
        actb_removeEvent(document, "keypress", actb_keypress);
        actb_removeEvent(document, "mousedown", actb_mousedown);
        actb_removedisp()
    }
    function actb_mousedown(evt) {
        if (!actb_display) {
            return true
        }
        if (evt.srcElement != actb_curr && !checkContainerById(evt.srcElement, "AutoCompleteBox")) {
            actb_clear(evt)
        }
        return true
    }
    function checkContainerById(src, id) {
        var cur = src;
        while (cur) {
            if (cur.id == id) {
                return true
            }
            cur = cur.parentNode
        }
        return false
    }
    function actb_parse(n) {
        if (actb_self.actb_delimiter.length > 0) {
            var t = actb_delimwords[actb_cdelimword].actb_trim().actb_addslashes();
            var plen = actb_delimwords[actb_cdelimword].actb_trim().length
        } else {
            var t = actb_curr.value.actb_addslashes();
            var plen = actb_curr.value.length
        }
        var tobuild = "";
        var i;
        if (actb_self.actb_firstText) {
            var re = new RegExp("^" + t, "i")
        } else {
            var re = new RegExp(t, "i")
        }
        var p = n.search(re);
        for (i = 0; i < p; i++) {
            tobuild += n.substr(i, 1)
        }
        tobuild += "<font style='" + (actb_self.actb_hStyle) + "'>";
        for (i = p; i < plen + p; i++) {
            tobuild += n.substr(i, 1)
        }
        tobuild += "</font>";
        for (i = plen + p; i < n.length; i++) {
            tobuild += n.substr(i, 1)
        }
        return tobuild
    }
    function actb_generate() {
        var menu_name = window.acField.GMenu();
        var menu = ARMenu.getMenu(window.acField.windowID, menu_name);
        if (menu == null) {
            handleMenuAbsent(menu_name);
            return
        }
        if (document.getElementById("AutoCompleteBox")) {
            actb_display = false;
            actb_parent.removeChild(document.getElementById("AutoCompleteBox"))
        }
        actb_pos = -1;
        var a, r, c;
        a = document.createElement("table");
        a.cellSpacing = "1px";
        a.cellPadding = "2px";
        a.style.position = "absolute";
        var res = ComputeElementPosition(actb_curr, actb_parent, actb_curr.scrollLeft, 0);
        a.style.top = eval(res.y + actb_curr.offsetHeight) + "px";
        a.style.left = res.x + "px";
        a.style.zIndex = this.actb_zIndex;
        a.style.visibility = "hidden";
        a.id = "AutoCompleteBox";
        actb_parent.appendChild(a);
        if (menu.getAttribute(menu.cfid, "tItems") == 0 || menu.getAttribute(menu.cfid, "state") <= 0) {
            actb_display = false;
            if (menu.getAttribute(menu.cfid, "state") == 0) {
                showACTips(menu, a)
            } else {
                if (menu.getAttribute(menu.cfid, "state") != 0 && menu.getAttribute(menu.cfid, "tItems") == 0) {
                    showEmpty(menu, a)
                }
            }
            return
        }
        var i;
        var first = true;
        var j = 1;
        if (actb_self.actb_mouse) {
            a.onmouseout = actb_table_unfocus;
            a.onmouseover = actb_table_focus
        }
        var len = menu.getAttribute(menu.cfid, "acField").mInputNode.value.length;
        if (menu.getAttribute(menu.cfid, "state") == 1) {
            this.showAll = actb_total == menu.getAttribute(menu.cfid, "tItems") || menu.getAttribute(menu.cfid, "tItems") == 0
        }
        if (menu.getAttribute(menu.cfid, "state") == 3) {
            this.showAll = true
        }
        if (this.showAll) {
            menu.setState(2);
            if (menu.getAttribute(menu.cfid, "fText") == "") {
                menu.setAttribute(menu.cfid, "fText", menu.getAttribute(menu.cfid, "acField").mInputNode.value)
            }
        } else {
            var titems = menu.getAttribute(menu.cfid, "tItems");
            if (titems != -1) {
                showPartialLabel(a)
            }
            menu.setState(1);
            menu.getAttribute(menu.cfid, "fText", "")
        }
        var counter = 0;
        for (i = 0; i < actb_self.actb_keywords.length; i++) {
            if (actb_bool[i]) {
                counter++;
                if (counter > this.SUGGESTION_SIZE) {
                    break
                }
                r = a.insertRow( - 1);
                r.className = "AutoCompleteNonSelection";
                r.id = "tat_tr" + (j);
                c = r.insertCell( - 1);
                var keyword = actb_self.actb_keywords[i];
                if (keyword == "") {
                    keyword = actb_self.actb_values[i]
                }
                c.innerHTML = actb_parse(keyword);
                c.id = "tat_td" + (j);
                c.setAttribute("pos", j);
                c.setAttribute("nowrap", "nowrap");
                if (actb_self.actb_mouse) {
                    c.style.cursor = "pointer";
                    c.onclick = actb_mouseclick;
                    c.onmouseover = actb_table_highlight
                }
                j++
            }
            if (j - 1 == actb_self.actb_lim && j < actb_total) {
                r = a.insertRow( - 1);
                r.className = "AutoCompleteDownArrow";
                c = r.insertCell( - 1);
                if (actb_self.actb_mouse) {
                    c.style.cursor = "pointer";
                    c.onclick = actb_mouse_down
                }
                break
            }
        }
        if (a.innerHTML == "" && menu.getAttribute(menu.cfid, "tItems") != -1) {
            showEmpty(menu, a);
            return
        }
        actb_rangeu = 1;
        actb_ranged = j - 1;
        actb_display = true;
        if (res.y + actb_curr.offsetHeight + a.clientHeight - 10 > actb_parent.clientHeight + actb_parent.scrollTop) {
            var highTop = res.y -= a.offsetHeight;
            a.style.top = highTop + "px"
        }
        a.style.visibility = "inherit";
        if ("external" in top) {
            try {
                top.external.ShowAutoComplete()
            } catch(e) {}
        }
        if (a.offsetWidth < menu.getAttribute(menu.cfid, "acField").mInputNode.offsetWidth) {
            a.style.width = menu.getAttribute(menu.cfid, "acField").mInputNode.offsetWidth + "px"
        }
        menu.setAttribute(menu.cfid, "messageOnly", false)
    }
    function showEmpty(menu, a) {
        menu.messageOnly = true;
        var r = a.insertRow( - 1);
        r.className = "AutoCompleteNonSelection";
        var c = r.insertCell( - 1);
        c.innerHTML = getLocalizedMessage("No suggestion was found");
        c.style.color = "blue";
        actb_rangeu = 1;
        actb_display = true;
        a.style.visibility = "inherit"
    }
    function showACTips(menu, a) {
        menu.messageOnly = true;
        var r = a.insertRow( - 1);
        r.className = "AutoCompleteNonSelection";
        var c = r.insertCell( - 1);
        c.innerHTML = getLocalizedMessage("[Please type more to see suggestions]");
        c.style.color = "blue";
        actb_rangeu = 1;
        actb_display = true;
        a.style.visibility = "inherit"
    }
    function showPartialLabel(a) {
        var r = a.insertRow( - 1);
        r.className = "AutoCompleteNonSelection";
        var c = r.insertCell( - 1);
        c.innerHTML = getLocalizedMessage("[Partial result]");
        c.style.color = "blue"
    }
    function actb_remake() {
        var menu_name = window.acField.GMenu();
        var menu = ARMenu.getMenu(window.acField.windowID, menu_name);
        if (menu == null) {
            handleMenuAbsent(menu_name);
            return
        }
        actb_parent.removeChild(document.getElementById("AutoCompleteBox"));
        var a, r, c;
        a = document.createElement("table");
        a.cellSpacing = "1px";
        a.cellPadding = "2px";
        a.style.position = "absolute";
        var res = ComputeElementPosition(actb_curr, actb_parent, 0, 0);
        a.style.top = eval(res.y + actb_curr.offsetHeight) + "px";
        a.style.left = res.x + "px";
        a.style.backgroundColor = actb_self.actb_bgColor;
        a.id = "AutoCompleteBox";
        a.style.zIndex = this.actb_zIndex;
        if (actb_kwcount == 0 || menu.getAttribute(menu.cfid, "state") == 0) {
            actb_display = false;
            if (menu.getAttribute(menu.cfid, "state") == 0) {
                showACTips(menu, a)
            } else {
                if (menu.getAttribute(menu.cfid, "state") == 1 && menu.getAttribute(menu.cfid, "tItems") == 0 && actb_self.actb_keywords.length == 1) {
                    showEmpty(menu, a)
                }
            }
            return
        }
        if (actb_self.actb_mouse) {
            a.onmouseout = actb_table_unfocus;
            a.onmouseover = actb_table_focus
        }
        actb_parent.appendChild(a);
        if (menu.getAttribute(menu.cfid, "state") == 1) {
            this.showAll = actb_total == menu.getAttribute(menu.cfid, "tItems") || menu.getAttribute(menu.cfid, "tItems") == 0
        }
        if (menu.getAttribute(menu.cfid, "state") == 3) {
            this.showAll = true
        }
        if (this.showAll) {
            menu.setState(2);
            if (menu.getAttribute(menu.cfid, "fText") == "") {
                menu.setAttribute(menu.cfid, "fText", menu.getAttribute(menu.cfid, acField).mInputNode.value)
            }
        } else {
            showPartialLabel(a);
            menu.setState(1);
            menu.getAttribute(menu.cfid, "fText", "")
        }
        var i;
        var first = true;
        var j = 1;
        if (actb_rangeu > 1) {
            r = a.insertRow( - 1);
            r.className = "AutoCompleteUpArrow";
            c = r.insertCell( - 1);
            if (actb_self.actb_mouse) {
                c.style.cursor = "pointer";
                c.onclick = actb_mouse_up
            }
        }
        for (i = 0; i < actb_self.actb_keywords.length; i++) {
            if (actb_bool[i]) {
                if (j >= actb_rangeu && j <= actb_ranged) {
                    r = a.insertRow( - 1);
                    r.className = "AutoCompleteNonSelection";
                    r.id = "tat_tr" + (j);
                    c = r.insertCell( - 1);
                    var keyword = actb_self.actb_keywords[i];
                    if (keyword == "") {
                        keyword = actb_self.actb_values[i]
                    }
                    c.innerHTML = actb_parse(keyword);
                    c.id = "tat_td" + (j);
                    c.setAttribute("pos", j);
                    c.setAttribute("nowrap", "nowrap");
                    if (actb_self.actb_mouse) {
                        c.style.cursor = "pointer";
                        c.onclick = actb_mouseclick;
                        c.onmouseover = actb_table_highlight
                    }
                    j++
                } else {
                    j++
                }
            }
            if (j > actb_ranged) {
                break
            }
        }
        if (j - 1 < actb_total) {
            r = a.insertRow( - 1);
            r.className = "AutoCompleteDownArrow";
            c = r.insertCell( - 1);
            if (actb_self.actb_mouse) {
                c.style.cursor = "pointer";
                c.onclick = actb_mouse_down
            }
        }
        if (res.y + actb_curr.offsetHeight + a.clientHeight - 10 > actb_parent.clientHeight + actb_parent.scrollTop) {
            var highTop = res.y -= a.offsetHeight;
            a.style.top = highTop + "px"
        }
    }
    function actb_goup() {
        if (!actb_display) {
            return
        }
        if (actb_pos == 1) {
            return
        }
        var preSel = document.getElementById("tat_tr" + actb_pos);
        if (preSel) {
            preSel.className = "AutoCompleteNonSelection"
        }
        pos_up();
        if (actb_pos < actb_rangeu) {
            actb_moveup()
        }
        document.getElementById("tat_tr" + actb_pos).className = "AutoCompleteSelection";
        if (actb_toid) {
            clearTimeout(actb_toid)
        }
        if (actb_self.actb_timeOut > 0) {
            actb_toid = setTimeout(function() {
                actb_mouse_on_list = 0;
                actb_removedisp()
            },
            actb_self.actb_timeOut)
        }
    }
    function actb_godown() {
        if (!actb_display) {
            return
        }
        if (actb_pos == actb_total) {
            return
        }
        var preSel = document.getElementById("tat_tr" + actb_pos);
        if (preSel) {
            preSel.className = "AutoCompleteNonSelection"
        }
        pos_down();
        if (actb_pos > actb_ranged) {
            actb_movedown()
        }
        document.getElementById("tat_tr" + actb_pos).className = "AutoCompleteSelection";
        if (actb_toid) {
            clearTimeout(actb_toid)
        }
        if (actb_self.actb_timeOut > 0) {
            actb_toid = setTimeout(function() {
                actb_mouse_on_list = 0;
                actb_removedisp()
            },
            actb_self.actb_timeOut)
        }
    }
    function actb_movedown() {
        actb_rangeu++;
        actb_ranged++;
        actb_remake()
    }
    function actb_moveup() {
        actb_rangeu--;
        actb_ranged--;
        actb_remake()
    }
    function pos_up() {
        actb_pos--;
        if (actb_pos < 1) {
            actb_pos = 1
        }
        actb_pos = actb_pos > actb_ranged ? actb_ranged: actb_pos
    }
    function pos_down() {
        actb_pos++;
        if (actb_pos == 0) {
            actb_pos = 1
        }
        actb_pos = actb_pos < actb_rangeu ? actb_rangeu: actb_pos
    }
    function actb_mouse_down() {
        var preSel = document.getElementById("tat_tr" + actb_pos);
        if (preSel) {
            preSel.className = "AutoCompleteNonSelection"
        }
        actb_movedown();
        pos_down();
        document.getElementById("tat_tr" + actb_pos).className = "AutoCompleteSelection";
        actb_curr.focus();
        actb_mouse_on_list = 0;
        if (actb_toid) {
            clearTimeout(actb_toid)
        }
        if (actb_self.actb_timeOut > 0) {
            actb_toid = setTimeout(function() {
                actb_mouse_on_list = 0;
                actb_removedisp()
            },
            actb_self.actb_timeOut)
        }
    }
    function actb_mouse_up(evt) {
        if (!evt) {
            evt = event
        }
        if (evt.stopPropagation) {
            evt.stopPropagation()
        } else {
            evt.cancelBubble = true
        }
        document.getElementById("tat_tr" + actb_pos).className = "AutoCompleteNonSelection";
        actb_pos--;
        actb_moveup();
        document.getElementById("tat_tr" + actb_pos).className = "AutoCompleteSelection";
        actb_curr.focus();
        actb_mouse_on_list = 0;
        if (actb_toid) {
            clearTimeout(actb_toid)
        }
        if (actb_self.actb_timeOut > 0) {
            actb_toid = setTimeout(function() {
                actb_mouse_on_list = 0;
                actb_removedisp()
            },
            actb_self.actb_timeOut)
        }
    }
    function actb_mouseclick(evt) {
        if (!evt) {
            evt = event
        }
        if (!actb_display) {
            return
        }
        actb_mouse_on_list = 0;
        actb_pos = this.getAttribute("pos");
        actb_penter()
    }
    function actb_table_focus() {
        actb_mouse_on_list = 1
    }
    function actb_table_unfocus() {
        actb_mouse_on_list = 0;
        if (actb_toid) {
            clearTimeout(actb_toid)
        }
        if (actb_self.actb_timeOut > 0) {
            actb_toid = setTimeout(function() {
                actb_mouse_on_list = 0;
                actb_removedisp()
            },
            actb_self.actb_timeOut)
        }
    }
    function actb_table_highlight() {
        actb_mouse_on_list = 1;
        var c = document.getElementById("tat_tr" + actb_pos);
        if (!c) {
            return
        }
        c.className = "AutoCompleteNonSelection";
        actb_pos = this.getAttribute("pos");
        while (actb_pos < actb_rangeu) {
            actb_moveup()
        }
        while (actb_pos > actb_ranged) {
            actb_movedown()
        }
        document.getElementById("tat_tr" + actb_pos).className = "AutoCompleteSelection";
        if (actb_toid) {
            clearTimeout(actb_toid)
        }
        if (actb_self.actb_timeOut > 0) {
            actb_toid = setTimeout(function() {
                actb_mouse_on_list = 0;
                actb_removedisp()
            },
            actb_self.actb_timeOut)
        }
    }
    function actb_insertword(a) {
        var str, l;
        if (actb_self.actb_delimiter.length > 0) {
            str = "";
            l = 0;
            for (i = 0; i < actb_delimwords.length; i++) {
                if (actb_cdelimword == i) {
                    prespace = postspace = "";
                    gotbreak = false;
                    for (j = 0; j < actb_delimwords[i].length; ++j) {
                        if (actb_delimwords[i].charAt(j) != " ") {
                            gotbreak = true;
                            break
                        }
                        prespace += " "
                    }
                    for (j = actb_delimwords[i].length - 1; j >= 0; --j) {
                        if (actb_delimwords[i].charAt(j) != " ") {
                            break
                        }
                        postspace += " "
                    }
                    str += prespace;
                    str += a;
                    l = str.length;
                    if (gotbreak) {
                        str += postspace
                    }
                } else {
                    str += actb_delimwords[i]
                }
                if (i != actb_delimwords.length - 1) {
                    str += actb_delimchar[i]
                }
            }
            actb_curr.value = str;
            actb_setCaret(actb_curr, l)
        } else {
            actb_curr.value = a;
            actb_setCaret(actb_curr, actb_curr.value.length)
        }
        actb_mouse_on_list = 0;
        actb_removedisp();
        if (actb_completionListener) {
            actb_completionListener(actb_curr)
        }
    }
    function actb_penter() {
        if (!actb_display || actb_pos == -1) {
            return
        }
        actb_display = false;
        var word = "";
        var c = 0;
        var len = 0;
        for (var i = 0; i <= actb_self.actb_values.length; i++) {
            if (actb_bool[i]) {
                c++
            }
            if (c == actb_pos) {
                word = actb_self.actb_values[i];
                break
            }
        }
        actb_insertword(word);
        l = actb_getCaretStart(actb_curr);
        actb_curr.actb_autoCompleted = true
    }
    function actb_removedisp() {
        if (actb_mouse_on_list == 0) {
            actb_display = 0;
            if (document.getElementById("AutoCompleteBox")) {
                actb_parent.removeChild(document.getElementById("AutoCompleteBox"))
            }
            if (actb_toid) {
                clearTimeout(actb_toid)
            }
        }
    }
    function actb_keypress(e) {
        if (actb_caretmove) {
            actb_stopEvent(e)
        }
        return ! actb_caretmove
    }
    function actb_checkkey(evt) {
        var a;
        if (!evt) {
            evt = event
        }
        a = evt.keyCode;
        caret_pos_start = actb_getCaretStart(actb_curr);
        actb_caretmove = 0;
        var menu_name = window.acField.GMenu();
        var menu = ARMenu.getMenu(window.acField.windowID, menu_name);
        if (menu == null) {
            handleMenuAbsent(menu_name);
            return
        }
        switch (a) {
        case 27:
            actb_clear(evt);
            actb_curr.actb_autoCompleteEnabled = false;
            return false;
        case 38:
            if (!menu.getAttribute(menu.cfid, "messageOnly")) {
                actb_goup();
                actb_caretmove = 1;
                actb_curr.actb_selected = true;
                return false
            }
            break;
        case 40:
            if (!menu.getAttribute(menu.cfid, "messageOnly")) {
                actb_godown();
                actb_caretmove = 1;
                actb_curr.actb_selected = true;
                return false
            }
            break;
        case 13:
        case 9:
            setTimeout(function() {
                if (actb_pos != 0) {
                    if (actb_display) {
                        actb_penter()
                    }
                }
            },
            1);
            if (actb_pos != 0) {
                actb_caretmove = 1
            }
            if (actb_caretmove && document.getElementById("AutoCompleteBox") && actb_pos > 0) {
                actb_stopEvent(evt)
            }
            return true;
        default:
            var menu_name = window.acField.GMenu();
            var menu = ARMenu.getMenu(window.acField.windowID, menu_name);
            if (menu == null) {
                handleMenuAbsent(menu_name);
                return true
            }
            var t = new Date().getTime();
            menu.checkPause(t);
            clearTimeout(menu.getAttribute(menu.cfid, "timer"));
            menu.setAttribute(menu.cfid, "preLen", menu.getAttribute(menu.cfid, "acField").mInputNode.value.length);
            menu.setAttribute(menu.cfid, "keyCode", a);
            setTimeout(actb_checkkey_handler, 1);
            break
        }
    }
    function actb_checkkey_handler() {
        var menu_name = window.acField.GMenu();
        var menu = ARMenu.getMenu(window.acField.windowID, menu_name);
        if (menu == null) {
            handleMenuAbsent(menu_name);
            return
        }
        menu.setAttribute(menu.cfid, "direction", menu.getAttribute(menu.cfid, "acField").mInputNode.value.length - menu.getAttribute(menu.cfid, "preLen"));
        menu.updateState();
        if (menu.getAttribute(menu.cfid, "state") != 1 && !menu.isRecovering()) {
            menu.setAttribute(menu.cfid, "typeState", 1);
            actb_tocomplete(menu.getAttribute(menu.cfid, "keyCode"))
        } else {
            menu.setAttribute(menu.cfid, "timer", setTimeout(function() {
                new WorkflowContext(window.acField.windowID, {
                    f: actb_reloadmenu,
                    a: [menu]
                })
            },
            menu.getAttribute(menu.cfid, "arautoctt")))
        }
    }
    function actb_reloadmenu(menu) {
        menu.setAttribute(menu.cfid, "typeState", 1);
        menu.updateState();
        menu.reload();
        actb_tocomplete(menu.getAttribute(menu.cfid, "keyCode"))
    }
    function actb_tocomplete(kc) {
        if (kc == 38 || kc == 40 || kc == 13) {
            return
        }
        var word, c;
        if ("actb_autoCompleteEnabled" in actb_curr && actb_curr.actb_autoCompleteEnabled == false) {
            return
        }
        if (acField && acField.mInputNode && !acField.mInputNode.hasFocus) {
            return
        }
        var i;
        if (actb_display) {
            word = 0;
            c = 0;
            for (var i = 0; i <= actb_self.actb_keywords.length; i++) {
                if (actb_bool[i]) {
                    c++
                }
                if (c == actb_pos) {
                    word = i;
                    break
                }
            }
            actb_pre = word
        } else {
            actb_pre = -1
        }
        if (actb_curr.value == "") {
            actb_mouse_on_list = 0;
            actb_removedisp();
            return
        }
        if (actb_self.actb_delimiter.length > 0) {
            caret_pos_start = actb_getCaretStart(actb_curr);
            caret_pos_end = actb_getCaretEnd(actb_curr);
            delim_split = "";
            for (i = 0; i < actb_self.actb_delimiter.length; i++) {
                delim_split += actb_self.actb_delimiter[i]
            }
            delim_split = delim_split.actb_addslashes();
            delim_split_rx = new RegExp("([" + delim_split + "])");
            c = 0;
            actb_delimwords = new Array();
            actb_delimwords[0] = "";
            for (i = 0, j = actb_curr.value.length; i < actb_curr.value.length; i++, j--) {
                if (actb_curr.value.substr(i, j).search(delim_split_rx) == 0) {
                    ma = actb_curr.value.substr(i, j).match(delim_split_rx);
                    actb_delimchar[c] = ma[1];
                    c++;
                    actb_delimwords[c] = ""
                } else {
                    actb_delimwords[c] += actb_curr.value.charAt(i)
                }
            }
            var l = 0;
            actb_cdelimword = -1;
            for (i = 0; i < actb_delimwords.length; i++) {
                if (caret_pos_end >= l && caret_pos_end <= l + actb_delimwords[i].length) {
                    actb_cdelimword = i
                }
                l += actb_delimwords[i].length + 1
            }
            var ot = actb_delimwords[actb_cdelimword].actb_trim();
            var t = actb_delimwords[actb_cdelimword].actb_addslashes().actb_trim()
        } else {
            var ot = actb_curr.value;
            var t = actb_curr.value.actb_addslashes()
        }
        if (ot.length == 0) {
            actb_mouse_on_list = 0;
            actb_removedisp()
        }
        if (ot.length < actb_self.actb_startcheck) {
            return this
        }
        if (actb_self.actb_firstText) {
            var re = new RegExp("^" + t, "i")
        } else {
            var re = new RegExp(t, "i")
        }
        actb_total = 0;
        actb_tomake = false;
        actb_kwcount = 0;
        var menu_name = window.acField.GMenu();
        var menu = ARMenu.getMenu(window.acField.windowID, menu_name);
        if (menu == null) {
            handleMenuAbsent(menu_name);
            return
        }
        if (menu.getAttribute(menu.cfid, "tItems") > 0 || menu.getAttribute(menu.cfid, "state") > 1) {
            for (i = 0; i < actb_self.actb_keywords.length; i++) {
                actb_bool[i] = false;
                var match = actb_self.actb_keywords[i];
                if (match == "") {
                    match = actb_self.actb_values[i]
                }
                if (actb_self.actb_lengths != null && actb_self.actb_lengths.length > 0) {
                    var length = actb_self.actb_lengths[i];
                    if (length != -1) {
                        match = match.substring(0, actb_self.actb_lengths[i])
                    }
                }
                if (re.test(match)) {
                    actb_total++;
                    actb_bool[i] = true;
                    actb_kwcount++;
                    if (actb_pre == i) {
                        actb_tomake = true
                    }
                }
            }
        }
        if (actb_toid) {
            clearTimeout(actb_toid)
        }
        if (actb_self.actb_timeOut > 0) {
            actb_toid = setTimeout(function() {
                actb_mouse_on_list = 0;
                actb_removedisp()
            },
            actb_self.actb_timeOut)
        }
        actb_generate()
    }
    return this
}
function actb_addEvent(f, d, b) {
    if (f.attachEvent) {
        f.attachEvent("on" + d, b)
    } else {
        if (f.actb_addEventListener) {
            f.actb_addEventListener(d, b, true)
        } else {
            f["on" + d] = b
        }
    }
}
function actb_removeEvent(f, d, b) {
    if (f.detachEvent) {
        f.detachEvent("on" + d, b)
    } else {
        if (f.removeEventListener) {
            f.removeEventListener(d, b, true)
        } else {
            f["on" + d] = null
        }
    }
}
function actb_stopEvent(b) {
    b || window.event;
    if (b.stopPropagation) {
        b.stopPropagation();
        b.preventDefault()
    } else {
        if (typeof b.cancelBubble != "undefined") {
            b.cancelBubble = true;
            b.returnValue = false
        }
    }
    return false
}
function actb_getCaretEnd(g) {
    if (typeof g.selectionEnd != "undefined") {
        return g.selectionEnd
    } else {
        if (document.selection && document.selection.createRange) {
            var h = document.selection.createRange();
            try {
                var b = h.duplicate();
                b.moveToElementText(g)
            } catch(f) {
                var b = g.createTextRange()
            }
            b.setEndPoint("EndToEnd", h);
            var d = b.text.length;
            if (d > g.value.length) {
                return - 1
            }
            return d
        }
    }
}
function actb_getCaretStart(g) {
    if (typeof g.selectionStart != "undefined") {
        return g.selectionStart
    } else {
        if (document.selection && document.selection.createRange) {
            var h = document.selection.createRange();
            try {
                var b = h.duplicate();
                b.moveToElementText(g)
            } catch(f) {
                var b = g.createTextRange()
            }
            b.setEndPoint("EndToStart", h);
            var d = b.text.length;
            if (d > g.value.length) {
                return - 1
            }
            return d
        }
    }
}
function actb_setCaret(d, b) {
    d.focus();
    d.setSelectionRange(b, b)
}
function actb_setSelection(f, b, d) {
    f.focus();
    f.setSelectionRange(b, d)
}
String.prototype.actb_addslashes = function() {
    return this.replace(/(["\\\.\|\[\]\^\*\+\?\$\(\)])/g, "\\$1")
};
String.prototype.actb_trim = function() {
    return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1")
};
function actb_isNumber(b) {
    return typeof b == "number" && isFinite(b)
}
var globalLogout = false;
var licenseTimeout = 60;
function licenseSessionInit() {
    licenseSessionOpenWindow();
    licenseInitialInit = true;
    tmp = getCookie("lt");
    if (tmp != null) {
        licenseTimeout = parseInt(tmp)
    }
    var b = getCookie("lr");
    if (b == null) {
        return
    } else {
        signalLicenseReleaseServlet(true)
    }
}
function licenseSessionExit() {
    globalLogout = true;
    deleteCookie("T", "/", null);
    deleteCookie("w" + window.name, "/", null)
}
function signalLicenseReleaseServlet(f) {
    var b;
    b = GET_XML_HTTP();
    if (f) {
        deleteCookie("lr", "/", null);
        b.open("GET", AbsContextPath + "servlet/LicenseReleaseServlet", true)
    } else {
        setCookie("lr", true, null, "/", null);
        if (AbsContextPath == null) {
            return
        }
        b.open("GET", AbsContextPath + "servlet/LicenseReleaseServlet?lr=1", true)
    }
    b.setRequestHeader("Content-type", "text/plain; charset=UTF-8");
    try {
        b.send(null);
        throw new WorkflowException(0, 0, [])
    } catch(d) {}
}
function licenseSessionOpenWindow() {
    if (window.name == "") {
        window.name = createARRootWindowName()
    }
    var b = 0;
    var d = getCookie("T");
    var f = getCookie("w" + window.name);
    if (d != null) {
        b = parseInt(d)
    } else {
        if (f != null) {
            b = 1
        }
    }
    if (f == null) {
        setCookie("w" + window.name, 1, null, "/", null);
        b++
    }
    setCookie("T", b, null, "/", null)
}
function licenseSessionCloseWindow() {
    var d = getCookie("T");
    var b = parseInt(d);
    deleteCookie("w" + window.name, "/", null);
    b--;
    if (b > 0) {
        setCookie("T", b, null, "/", null);
        return
    }
    if (!globalLogout) {
        deleteCookie("T", "/", null);
        signalLicenseReleaseServlet(false)
    }
}
CharEditPopup.prototype = new DIVPopup();
CharEditPopup.prototype.constructor = CharEditPopup;
CharEditPopup.superclass = DIVPopup.prototype;
function CharEditPopup(b) {
    if (arguments.length) {
        this.init(b)
    }
}
CharEditPopup.prototype.init = function(b) {
    this.mField = b;
    CharEditPopup.superclass.init.call(this, b.windowID, false, true, true, true, true);
    this.mbShowURL = this.mField.mbShowURL;
    this.SetSize(320, 300);
    if (b.GAccess() == 1) {
        this.Buttons = [{
            t: getLocalizedMessage("Cancel"),
            f: "OnCancel"
        }]
    }
};
CharEditPopup.prototype.SetContents = function(h) {
    if (h != undefined) {
        var h = h
    } else {
        if (this.mbShowURL) {
            var h = this.mField.mDivEditBox.innerHTML
        } else {
            var h = this.mField.mInputNode.value
        }
    }
    var g = 1;
    var f = [];
    f.push("<table style='width:100%;height:100%'>");
    if (getARStateCurrent_NS(this.windowID) != 1 && getARStateCurrent_NS(this.windowID) != 4 && this.mField instanceof DDiary) {
        var k = this.mField.GetHistory();
        if (k != null) {
            this.SetSize(320, 340);
            f.push(CharEditPopup.GetTitleMarkup(getLocalizedMessage("Diary History:")));
            f.push(CharEditPopup.GetTextareaMarkup("hEditor", g++, true, k, this.mbShowURL, this.mField.mID))
        }
        f.push(CharEditPopup.GetTitleMarkup(getLocalizedMessage("Diary Editor:")))
    }
    f.push(CharEditPopup.GetTextareaMarkup("editor", g++, this.mField.GAccess() == 1, h, this.mbShowURL, this.mField.mID));
    f.push("</table>");
    var b = (getARStateCurrent_NS(this.windowID) == 4) ? getARTitles_NS(this.windowID).pluralLong: getARTitles_NS(this.windowID).singleLong;
    if (b == "") {
        b = ARKWGetStringByIdx(this.windowID, 6)
    }
    var d = getLocalizedMessage("{0} ({1}) -- {2}", [b, ARKWGetStringByIdx(this.windowID, 7), this.mField.GLabel()]);
    CharEditPopup.superclass.SetContents.call(this, d, f.join(""));
    if (this.mbShowURL) {
        this.oldValue = this.mField.GetValue();
        if (this.mField.mOrgValue != this.oldValue) {
            this.mField.SetValue(this.oldValue);
            this.oldValue = this.mField.innerText();
            this.mField.mOrgValue = this.oldValue;
            h = this.mField.mDivEditBox.innerHTML
        }
        updateInnerHTML(this.GetEditor(), h);
        if (getARStateCurrent_NS(this.windowID) != 4 && this.mField instanceof DDiary) {
            var k = this.mField.GetHistory();
            if (k != null) {
                convertPlainToFormattedText(k, document.getElementById("hEditor" + this.mField.mID))
            }
        }
    } else {
        this.oldValue = this.mField.mInputNode.value
    }
};
CharEditPopup.GetTextareaMarkup = function(o, f, g, h, k, b) {
    var d = [];
    d.push("<tr><td>");
    if (k) {
        d.push("<div class='OverflowAuto' style='overflow:hidden;'>");
        d.push("<div artb=" + f + (g ? " readonly": "") + (g ? " contenteditable='false'": " contenteditable='true'") + " id='" + o + "" + b + "' class='DivEditor " + (g ? "readonly'>": "'>"));
        d.push("</div>")
    } else {
        d.push("<div class='OverflowAuto'>");
        d.push("<textarea artb=" + f + (g ? " readonly": "") + ' rows="5"  id=\'' + o + "' class='Editor " + (g ? "readonly'>": "'>"));
        d.push(h);
        d.push("</textarea>")
    }
    d.push("</div>");
    d.push("</td></tr>");
    return d.join("")
};
CharEditPopup.GetTitleMarkup = function(b) {
    return "<tr class='PopupEditorTitle'><td>" + b + "</td></tr>"
};
CharEditPopup.prototype.KeyDown = function(f) {
    if (f.ctrl && f.key == 86) {
        var b = this.mField.mMaxLen;
        var d = this.mField.mID;
        setTimeout(function() {
            checkPasteLength(f.element, b, d)
        },
        10)
    } else {
        if (f.key == 9 && f.ctrl == true) {
            if (!checkLength(f, this.mField.windowID, this.GetEditor(), this.mField.mMaxLen)) {
                this.mField.InsertAtCaret(this.GetEditor(), String.fromCharCode(9))
            }
            return false
        } else {
            if (f.key == 9) {
                this.DoTab(f, !f.shift);
                f.SetKeyCode(505);
                return false
            }
        }
    }
    return true
};
function checkPasteLength(g, b, f) {
    var d = Window_FromElement(g);
    if (getARStateCurrent_NS(d) == 4) {
        return
    }
    if (g.tagName == "DIV") {
        var h = getInnerText(g);
        if (b != 0 && h.length >= b) {
            g.innerHTML = "";
            convertPlainToURL(h.substr(0, b), g)
        }
        return
    }
    if (b != 0 && g.value.length >= b) {
        g.value = g.value.substr(0, b)
    }
}
CharEditPopup.prototype.KeyPress = function(b) {
    if (b.key == 27) {
        this.HidePopup();
        return false
    }
    if ((b.key == 13 || b.key == 32) && b.element.className.indexOf("btn") != -1) {
        b.element.click();
        return false
    }
    return checkLength(b, this.mField.windowID, this.GetEditor(), this.mField.mMaxLen)
};
CharEditPopup.prototype.Click = function(b) {
    if (b.element.tagName == "A") {
        return true
    }
    this.SetFocus();
    if ((b.element.parentNode.id || b.element.id) == "ardivpcancel") {
        this.OnCancel()
    }
    return false
};
CharEditPopup.prototype.SetFocus = function() {
    if (getOpenDIVPopup_NS(this.windowID) && getOpenDIVPopup_NS(this.windowID) != this) {
        var d = getCharEditPopups_NS(this.windowID).length;
        var b = parseInt(getCharEditPopups_NS(this.windowID)[d - 1].mDiv.style.zIndex);
        getOpenDIVPopup_NS(this.windowID).mDiv.style.zIndex = b;
        this.mDiv.style.zIndex = b + 1;
        var g = this.GetEditor();
        if (g != null) {
            g.focus()
        }
        for (var f = 0; f < d; f++) {
            if (this == getCharEditPopups_NS(this.windowID)[f]) {
                getCharEditPopups_NS(this.windowID).splice(f, 1)
            }
        }
        getCharEditPopups_NS(this.windowID).push(this);
        setOpenDIVPopup_NS(this.windowID, this)
    }
};
CharEditPopup.prototype.GetEditor = function() {
    if (this.mbShowURL) {
        return document.getElementById("editor" + this.mField.mID)
    }
    var d = this.mDiv.getElementsByTagName("textarea");
    for (var b = 0; b < d.length; b++) {
        if (d[b].id == "editor") {
            return d[b]
        }
    }
    return null
};
CharEditPopup.prototype.ShowCentredPopup = function(d) {
    var g = this.GetPosition();
    var b = getCharEditPopups_NS(this.windowID).length;
    g.x += b * 10;
    g.y += b * 15;
    getCharEditPopups_NS(this.windowID).push(this);
    this.ShowPopup(document.body, g.x, g.y, d);
    if ("external" in top) {
        try {
            top.external.ShowTextEditor()
        } catch(f) {}
    }
};
CharEditPopup.prototype.HidePopup = function(b) {
    this.mField.mCharEditBox = null;
    getCharEditPopups_NS(this.windowID).pop();
    if (getCharEditPopups_NS(this.windowID).length > 1) {
        setOpenDIVPopup_NS(this.windowID, getCharEditPopups_NS(this.windowID)[getCharEditPopups_NS(this.windowID).length - 1])
    }
    CharEditPopup.superclass.HidePopup.call(this, true)
};
CharEditPopup.prototype.GetOKButton = function() {
    var d = this.mDiv.getElementsByTagName("button");
    for (var b = 0; b < d.length; b++) {
        if (d[b].id == "ardivpok") {
            return d[b]
        }
    }
};
CharEditPopup.prototype.ShowPopup = function(g, h, d, b) {
    var q = this.GetOKButton();
    if (q) {
        q.disabled = true
    }
    var p = this.GetEditor();
    p.onkeydown = function() {
        if (q) {
            q.disabled = false
        }
    };
    p.onpaste = function() {
        if (q) {
            q.disabled = false
        }
    };
    var f = this.mDiv.getElementsByTagName("button");
    for (var o = 0; o < f.length; o++) {
        if (f[o].id == "ardivpcancel") {
            f[o].onclick = function(s) {}
        }
    }
    var k = getCharEditPopups_NS(this.windowID).length;
    getCharEditPopups_NS(this.windowID).push(this);
    CharEditPopup.superclass.ShowPopup.call(this, g, h, d, b)
};
CharEditPopup.prototype.ShowSingle = function() {
    return false
};
CharEditPopup.prototype.OnOK = function() {
    var d = this.GetEditor();
    if (d != null) {
        var b;
        if (this.mbShowURL) {
            b = this.innerText()
        } else {
            b = d.value
        }
        if (b != this.oldValue) {
            if (this.mbShowURL) {
                convertPlainToFormattedText(b, d);
                this.mField.SetScreenValue(d.innerHTML)
            } else {
                this.mField.SetScreenValue(b)
            }
            this.mField.SetDirty(this.mField.mInputNode)
        }
    }
    this.HidePopup(true)
};
CharEditPopup.prototype.OnCancel = function() {
    this.HidePopup(true)
};
CharEditPopup.prototype.InitFocus = function() {
    this.GetEditor().focus()
};
CharEditPopup.prototype.NewTextAvail = function() {
    var f = this.GetOKButton();
    var d = this.GetEditor();
    if (f && !f.disabled && d != null) {
        var b;
        if (this.mbShowURL) {
            b = this.innerText()
        } else {
            b = d.value
        }
        if (b != this.oldValue) {
            return true
        }
    }
    return false
};
CharEditPopup.prototype.GetText = function() {
    var b = this.GetEditor();
    if (b != null) {
        if (this.mbShowURL) {
            return this.innerText()
        }
        return b.value
    }
    return null
};
CharEditPopup.prototype.SetText = function(b) {
    if (this.mbShowURL) {
        updateInnerHTML(this.GetEditor(), b)
    } else {
        this.GetEditor().value = b
    }
};
CharEditBoxPopup_UpdateText = function(b, g, f) {
    b.SetText(g);
    var d = b.GetOKButton();
    if (d && f) {
        d.disabled = true
    }
};
CharEditBoxPopup_UpdateHistory = function(b, h) {
    if (b.mbShowURL) {
        var g = document.getElementById("hEditor" + b.mField.mID);
        convertPlainToFormattedText(h, g);
        return
    }
    var f = b.mDiv.getElementsByTagName("textarea");
    for (var d = 0; d < f.length; d++) {
        if (f[d].id == "hEditor") {
            f[d].value = h;
            return
        }
    }
};
CharEditPopup.prototype.innerText = function() {
    return getInnerText(this.GetEditor())
};
var tempElement = document.createElement("temp");
var rtfLocalized = false;
localizeRTFMessages = function() {
    if (rtfLocalized) {
        return
    }
    rtfLocalized = true;
    YAHOO.widget.Toolbar.prototype.STR_COLLAPSE = getLocalizedMessage("Collapse Toolbar");
    YAHOO.widget.Toolbar.prototype.STR_SPIN_LABEL = getLocalizedMessage("{VALUE}");
    YAHOO.widget.Toolbar.prototype.STR_SPIN_UP = getLocalizedMessage("Increase (Ctrl + Shift + Up Arrow)");
    YAHOO.widget.Toolbar.prototype.STR_SPIN_DOWN = getLocalizedMessage("Decrease (Ctrl + Shift + Down Arrow)");
    YAHOO.widget.SimpleEditor.prototype.STR_MAX_LENGTH_EXCEEDED = getLocalizedMessage("Maximum Length Exceeded.");
    YAHOO.widget.SimpleEditor.prototype.STR_LEAVE_EDITOR = getLocalizedMessage("You have left the Rich Text Editor.");
    YAHOO.widget.SimpleEditor.prototype.STR_BEFORE_EDITOR = getLocalizedMessage("This text field can contain stylized text and graphics. To cycle through all formatting options, use the keyboard shortcut Shift + Escape to place focus on the toolbar and navigate between options with your arrow keys. To exit this text editor use the Escape key and continue tabbing. <h4>Common formatting keyboard shortcuts:</h4><ul><li>Control Shift B sets text to bold</li> <li>Control Shift I sets text to italic</li> <li>Control Shift U underlines text</li> <li>Control Shift L adds an HTML link</li></ul>");
    YAHOO.widget.SimpleEditor.prototype.STR_TITLE = getLocalizedMessage("Rich Text Area.");
    YAHOO.widget.SimpleEditor.prototype.STR_IMAGE_HERE = getLocalizedMessage("Image URL Here");
    YAHOO.widget.SimpleEditor.prototype.STR_IMAGE_URL = getLocalizedMessage("Image URL");
    YAHOO.widget.SimpleEditor.prototype.STR_LINK_URL = getLocalizedMessage("Link URL");
    YAHOO.widget.SimpleEditor.prototype.STR_OK = getLocalizedMessage("OK");
    YAHOO.widget.SimpleEditor.prototype.STR_CANCEL = getLocalizedMessage("Cancel");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_FONT_NAME_AND_SIZE = getLocalizedMessage("Font Name and Size");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_FONT_STYLE = getLocalizedMessage("Font Style");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_LISTS = getLocalizedMessage("Lists");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_INSERT_ITEM = getLocalizedMessage("Insert Item");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_BOLD = getLocalizedMessage("Bold");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_ITALIC = getLocalizedMessage("Italic");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_UNDERLINE = getLocalizedMessage("Underline");
    YAHOO.widget.SimpleEditor.prototype.STRIKE = getLocalizedMessage("Strike Through");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_FONT_COLOR = getLocalizedMessage("Font Color");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_BACKGROUND_COLOR = getLocalizedMessage("Background Color");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_CREATE_UNORDERED_LIST = getLocalizedMessage("Create an Unordered List");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_CREATE_ORDERED_LIST = getLocalizedMessage("Create an Ordered List");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_HTML_LINK = getLocalizedMessage("HTML Link");
    YAHOO.widget.SimpleEditor.prototype.STR_LABEL_INSERT_IMAGE = getLocalizedMessage("Insert or Change Image");
    YAHOO.widget.Editor.prototype.STR_BEFORE_EDITOR = getLocalizedMessage("This text field can contain stylized text and graphics. To cycle through all formatting options, use the keyboard shortcut Control + Shift + T to place focus on the toolbar and navigate between option heading names. <h4>Common formatting keyboard shortcuts:</h4><ul><li>Control Shift B sets text to bold</li> <li>Control Shift I sets text to italic</li> <li>Control Shift U underlines text</li> <li>Control Shift [ aligns text left</li> <li>Control Shift | centers text</li> <li>Control Shift ] aligns text right</li> <li>Control Shift L adds an HTML link</li> <li>To exit this text editor use the keyboard shortcut Control + Shift + ESC.</li></ul>");
    YAHOO.widget.Editor.prototype.STR_CLOSE_WINDOW = getLocalizedMessage("Close Window");
    YAHOO.widget.Editor.prototype.STR_CLOSE_WINDOW_NOTE = getLocalizedMessage("To close this window use the Control + Shift + W key");
    YAHOO.widget.Editor.prototype.STR_IMAGE_PROP_TITLE = getLocalizedMessage("Image Options");
    YAHOO.widget.Editor.prototype.STR_IMAGE_TITLE = getLocalizedMessage("Description");
    YAHOO.widget.Editor.prototype.STR_IMAGE_SIZE = getLocalizedMessage("Size");
    YAHOO.widget.Editor.prototype.STR_IMAGE_ORIG_SIZE = getLocalizedMessage("Original Size");
    YAHOO.widget.Editor.prototype.STR_IMAGE_COPY = getLocalizedMessage("<span class='tip'><span class='icon icon-info'></span><strong>Note:</strong>To move this image just highlight it, cut, and paste where ever you'd like.</span>");
    YAHOO.widget.Editor.prototype.STR_IMAGE_PADDING = getLocalizedMessage("Padding");
    YAHOO.widget.Editor.prototype.STR_IMAGE_BORDER = getLocalizedMessage("Border");
    YAHOO.widget.Editor.prototype.STR_IMAGE_BORDER_SIZE = getLocalizedMessage("Border Size");
    YAHOO.widget.Editor.prototype.STR_IMAGE_BORDER_TYPE = getLocalizedMessage("Border Type");
    YAHOO.widget.Editor.prototype.STR_IMAGE_TEXTFLOW = getLocalizedMessage("Text Flow");
    YAHOO.widget.Editor.prototype.STR_LOCAL_FILE_WARNING = getLocalizedMessage("<span class='tip'><span class='icon icon-warn'></span><strong>Note:</strong>This image/link points to a file on your computer and will not be accessible to others on the internet.</span>");
    YAHOO.widget.Editor.prototype.STR_LINK_PROP_TITLE = getLocalizedMessage("Link Options");
    YAHOO.widget.Editor.prototype.STR_LINK_PROP_REMOVE = getLocalizedMessage("Remove link from text");
    YAHOO.widget.Editor.prototype.STR_LINK_NEW_WINDOW = getLocalizedMessage("Open in a new window.");
    YAHOO.widget.Editor.prototype.STR_LINK_TITLE = getLocalizedMessage("Description");
    YAHOO.widget.Editor.prototype.STR_NONE = getLocalizedMessage("none");
    YAHOO.widget.Editor.prototype.STR_LABEL_SUBSCRIPT = getLocalizedMessage("Subscript");
    YAHOO.widget.Editor.prototype.STR_LABEL_SUPERSCRIPT = getLocalizedMessage("Superscript");
    YAHOO.widget.Editor.prototype.STR_LABEL_REMOVE_FORMATTING = getLocalizedMessage("Remove Formatting");
    YAHOO.widget.Editor.prototype.STR_LABEL_SHOW_HIDE_HIDDEN_ELEMENTS = getLocalizedMessage("Show/Hide Hidden Elements");
    YAHOO.widget.Editor.prototype.STR_LABEL_UNDO_REDO = getLocalizedMessage("Undo/Redo");
    YAHOO.widget.Editor.prototype.STR_LABEL_UNDO = getLocalizedMessage("Undo");
    YAHOO.widget.Editor.prototype.STR_LABEL_REDO = getLocalizedMessage("Redo");
    YAHOO.widget.Editor.prototype.STR_LABEL_ALIGNMENT = getLocalizedMessage("Alignment");
    YAHOO.widget.Editor.prototype.STR_LABEL_ALIGNMENT_LEFT = getLocalizedMessage("Align Left");
    YAHOO.widget.Editor.prototype.STR_LABEL_ALIGNMENT_CENTER = getLocalizedMessage("Align Center");
    YAHOO.widget.Editor.prototype.STR_LABEL_ALIGNMENT_RIGHT = getLocalizedMessage("Align Right");
    YAHOO.widget.Editor.prototype.STR_LABEL_ALIGNMENT_JUSTIFY = getLocalizedMessage("Justify");
    YAHOO.widget.Editor.prototype.STR_LABEL_PARAGRAPH_STYLE = getLocalizedMessage("Paragraph Style");
    YAHOO.widget.Editor.prototype.STR_LABEL_INDENT_LIST = getLocalizedMessage("Indenting and Lists");
    YAHOO.widget.Editor.prototype.STR_LABEL_INDENT = getLocalizedMessage("Indent");
    YAHOO.widget.Editor.prototype.STR_LABEL_OUTDENT = getLocalizedMessage("Outdent");
    YAHOO.widget.Editor.prototype.STR_LABEL_LEFT = getLocalizedMessage("Left");
    YAHOO.widget.Editor.prototype.STR_LABEL_INLINE = getLocalizedMessage("Inline");
    YAHOO.widget.Editor.prototype.STR_LABEL_BLOCK = getLocalizedMessage("Block");
    YAHOO.widget.Editor.prototype.STR_LABEL_RIGHT = getLocalizedMessage("Right");
    YAHOO.widget.Editor.prototype.STR_LABEL_BORDER_COLOR = getLocalizedMessage("Border Color");
    YAHOO.widget.Editor.prototype.STR_TEXT_SOLID = getLocalizedMessage("Solid");
    YAHOO.widget.Editor.prototype.STR_TEXT_DASHED = getLocalizedMessage("Dashed");
    YAHOO.widget.Editor.prototype.STR_TEXT_DOTTED = getLocalizedMessage("Dotted");
    RichTextWidget.prototype.STR_LABEL_INSERT_TABLE = getLocalizedMessage("Insert or Change Table");
    RichTextWidget.prototype.STR_LABEL_TABLE = getLocalizedMessage("Table");
    RichTextWidget.prototype.STR_LABEL_CELL_PROPERTIES = getLocalizedMessage("Cell Properties");
    RichTextWidget.prototype.STR_TABLE_TITLE = getLocalizedMessage("Table Options");
    RichTextWidget.prototype.STR_TABLE_COLUMNS = getLocalizedMessage("Columns");
    RichTextWidget.prototype.STR_TABLE_CELL_SPACING = getLocalizedMessage("Cell Spacing");
    RichTextWidget.prototype.STR_TABLE_ROWS = getLocalizedMessage("Rows");
    RichTextWidget.prototype.STR_TABLE_CELL_PADDING = getLocalizedMessage("Cell Padding");
    RichTextWidget.prototype.STR_TABLE_BORDER = getLocalizedMessage("Table Border");
    RichTextWidget.prototype.STR_TABLE_BORDER_SIZE = getLocalizedMessage("Table Border Size");
    RichTextWidget.prototype.STR_TABLE_BORDER_TYPE = getLocalizedMessage("Table Border Type");
    RichTextWidget.prototype.STR_LABEL_TABLE_BORDER_COLOR = getLocalizedMessage("Table Border Color");
    RichTextWidget.prototype.STR_TABLE_CELL_BORDER = getLocalizedMessage("Cell Border");
    RichTextWidget.prototype.STR_TABLE_CELL_BORDER_SIZE = getLocalizedMessage("Cell Border Size");
    RichTextWidget.prototype.STR_TABLE_CELL_BORDER_TYPE = getLocalizedMessage("Cell Border Type");
    RichTextWidget.prototype.STR_LABEL_TABLE_CELL_BORDER_COLOR = getLocalizedMessage("Cell Border Color");
    RichTextWidget.prototype.STR_TABLE_CAPTION = getLocalizedMessage("Table Caption");
    RichTextWidget.prototype.STR_CELL_PROPERTIES_TITLE = getLocalizedMessage("Cell Options");
    RichTextWidget.prototype.STR_CELL_HORIZONTAL_ALIGNMENT = getLocalizedMessage("Horizontal Alignment");
    RichTextWidget.prototype.STR_CELL_VERTICAL_ALIGNMENT = getLocalizedMessage("Vertical Alignment");
    RichTextWidget.prototype.STR_CELL_BACKGROUND_COLOR = getLocalizedMessage("Background Color");
    RichTextWidget.prototype.STR_CELL_BORDER = getLocalizedMessage("Border");
    RichTextWidget.prototype.STR_CELL_BORDER_SIZE = getLocalizedMessage("Border Size");
    RichTextWidget.prototype.STR_CELL_BORDER_TYPE = getLocalizedMessage("Border Type");
    RichTextWidget.prototype.STR_CELL_BORDER_COLOR = getLocalizedMessage("Border Color");
    RichTextWidget.prototype.STR_TEXT_LEFT = getLocalizedMessage("Left");
    RichTextWidget.prototype.STR_TEXT_CENTER = getLocalizedMessage("Center");
    RichTextWidget.prototype.STR_TEXT_RIGHT = getLocalizedMessage("Right");
    RichTextWidget.prototype.STR_TEXT_TOP = getLocalizedMessage("Top");
    RichTextWidget.prototype.STR_TEXT_BOTTOM = getLocalizedMessage("Bottom")
};
updateRtfHtml = function(d, B, f, y, b) {
    if (typeof y == "undefined" || y == null) {
        y = ARKWGetStringByIdx(d, 7)
    }
    if (typeof schema == "undefined" || schema == null) {
        schema = ARKWGetStringByIdx(d, 6)
    }
    if (typeof f == "undefined" || f == null) {
        var q = getFields_NS(d)[1];
        f = null;
        if (q && q.mObj && q.mObj.v && q.mObj.v.mValue) {
            f = q.mObj.v.mValue
        }
    }
    var s = B;
    tempElement.innerHTML = B;
    if (tempElement != null) {
        var v = null;
        var E = false;
        var p = tempElement.getElementsByTagName("img");
        for (z = 0; z < p.length; z++) {
            var v = p[z];
            if (v) {
                var u = v.getAttribute("arattid");
                if (u != null && u.length > 0) {
                    var o = parseInt(u);
                    u = v.getAttribute("arschema");
                    if (u && u.length > 0) {
                        schema = u
                    }
                    var G = v.getAttribute("arentryid");
                    if (G != null && G.length > 0) {
                        f = G
                    }
                    var w = (AbsContextPath + "resources/javascript/8.0.00/YUI/assets/skins/sam/brokenimage.png");
                    var C = false;
                    if (o > 0) {
                        var g = false;
                        var k = true;
                        if (o in getFields_NS(d)) {
                            var A = getFields_NS(d)[o];
                            k = false;
                            if (A != null && A instanceof JAttachment && A.IsDirty() && A.mObj && A.mObj.v && A.mObj.v.mDataKey && A.mObj.v.mDataKey.length > 0) {
                                var D = JAttachment.getAttachServletURL() + "/" + new Date().getTime();
                                var H = JAttachment.getURLParams("1", A.mObj.v.mDataKey);
                                var h = D + "?ATTKey=" + H;
                                w = h;
                                g = true;
                                C = true
                            }
                        }
                        if (!g && f != null && f.length > 0 && k) {
                            w = AbsContextPath + "sharedresources/attachment/" + schema + "/" + o + "/" + f + "?server=" + y + "&?timestamp=" + new Date().getTime();
                            C = true
                        }
                        if (C) {
                            v.setAttribute("src", w);
                            if (f != null && f.length > 0) {
                                v.setAttribute("arentryid", f + "")
                            } else {
                                v.setAttribute("arentryid", "")
                            }
                            E = true
                        }
                    }
                }
            }
        }
        if (E) {
            s = tempElement.innerHTML
        }
        tempElement.innerHTML = ""
    }
    return s
};
stripImgHtml = function(f) {
    var d = f;
    tempElement.innerHTML = f;
    if (tempElement != null) {
        var k = null;
        var h = false;
        var b = tempElement.getElementsByTagName("img");
        for (z = 0; z < b.length; z++) {
            var k = b[z];
            if (k) {
                var g = k.getAttribute("arattid");
                if (g != null && g.length > 0) {
                    k.setAttribute("src", "");
                    h = true
                }
            }
        }
        if (h) {
            d = tempElement.innerHTML
        }
        tempElement.innerHTML = ""
    }
    return d
};
compareHtml = function(f, g) {
    var b = stripImgHtml(f);
    var d = stripImgHtml(g);
    tempElement.innerHTML = b;
    b = tempElement.innerHTML;
    tempElement.innerHTML = d;
    d = tempElement.innerHTML;
    tempElement.innerHTML = "";
    return (b == d)
};
RichTextWidget = function(d, g, f, h) {
    localizeRTFMessages();
    this.MTYPE = g;
    this.windowID = d;
    RichTextWidget.superclass.constructor.call(this, g, f);
    var b = YAHOO.util.Event;
    this.setAttachmentPoolField(h)
};
if (YAHOO != null && YAHOO.widget != null && YAHOO.widget.Editor != null) {
    YAHOO.extend(RichTextWidget, YAHOO.widget.Editor, {
        STR_IMAGE_HERE_ATTACH: getLocalizedMessage("Insert URL or click the Browse button (...) to attach an image."),
        STR_IMAGE_HERE_ORIG: getLocalizedMessage("Image URL Here"),
        _lastAttachFieldID: -1,
        _attachmentPoolField: null,
        _oldZIndex: null,
        _keyExtMap: {
            CREATE_TABLE: {
                key: 84,
                mods: ["ctrl"]
            },
            CELL_PROPERTIES: {
                key: 67,
                mods: ["ctrl"]
            }
        },
        _render: function() {
            RichTextWidget.superclass._render.call(this);
            var b = this;
            var d = {
                group: "table",
                label: "&nbsp;",
                buttons: [{
                    type: "push",
                    label: b.STR_LABEL_INSERT_TABLE + " (Ctrl + Shift + T)",
                    value: "createtable"
                },
                {
                    type: "push",
                    label: b.STR_LABEL_CELL_PROPERTIES + " (Ctrl + Shift + C)",
                    value: "cellproperties",
                    disabled: true
                }]
            };
            b.toolbar.addSeparator();
            b.toolbar.addButtonGroup(d);
            b.toolbar.on("createtableClick", b._handleCreateTableClick, b, true);
            b.on("windowcreatetableClose", b._handleCreateTableWindowClose, b, true);
            b.toolbar.on("cellpropertiesClick", b._handleCellPropertiesClick, b, true);
            b.on("windowcellpropertiesClose", b._handleCellPropertiesWindowClose, b, true);
            this.on("beforeEditorKeyDown",
            function(o) {
                if (this._isNonEditable(o.ev)) {
                    return false
                }
                this._setCurrentEvent(o.ev);
                if (this.currentWindow) {
                    this.closeWindow()
                }
                if (this.currentWindow) {
                    this.closeWindow()
                }
                switch (o.ev.keyCode) {
                case b._keyExtMap.CREATE_TABLE.key:
                    if (b._checkKey(this._keyExtMap.CREATE_TABLE, o.ev)) {
                        var k = true;
                        if (b.get("limitCommands")) {
                            if (!b.toolbar.getButtonByValue("createtable")) {
                                k = false
                            }
                        }
                        if (k) {
                            b.execCommand("createtable", "");
                            b.toolbar.fireEvent("createtableClick", {
                                type: "createtableClick",
                                target: b.toolbar
                            });
                            b.fireEvent("afterExecCommand", {
                                type: "afterExecCommand",
                                target: b
                            });
                            doExec = false
                        }
                        return false
                    }
                    break;
                case b._keyExtMap.CELL_PROPERTIES.key:
                    if (b._checkKey(this._keyExtMap.CREATE_TABLE, o.ev)) {
                        var f = true;
                        if (b.get("limitCommands")) {
                            if (!b.toolbar.getButtonByValue("cellproperties")) {
                                f = false
                            }
                        }
                        if (f) {
                            b.execCommand("cellproperties", "");
                            b.toolbar.fireEvent("cellpropertiesClick", {
                                type: "cellpropertiesClick",
                                target: b.toolbar
                            });
                            b.fireEvent("afterExecCommand", {
                                type: "afterExecCommand",
                                target: b
                            });
                            doExec = false
                        }
                        return false
                    }
                    break;
                case 46:
                case 8:
                    if (!b._hasSelection()) {
                        var g = b._getRange(b._getSelection());
                        if (g) {
                            var h = null;
                            if (o.ev.keyCode == 8 && g.startOffset == 0 && g.startContainer) {
                                h = g.startContainer.previousSibling;
                                if (h == null && g.startContainer.parentNode) {
                                    h = g.startContainer.parentNode.previousSibling
                                }
                            } else {
                                if (o.ev.keyCode == 46 && g.startContainer && g.startOffset == g.startContainer.length) {
                                    h = g.startContainer.nextSibling;
                                    if (h == null && g.startContainer.parentNode) {
                                        h = g.startContainer.parentNode.previousSibling
                                    }
                                }
                            }
                            if (h && h.parentNode && h.tagName == "TABLE") {
                                h.parentNode.removeChild(h);
                                return false
                            }
                        }
                    }
                    break
                }
                return true
            });
            this.on("beforeEditorDoubleClick",
            function(g) {
                if (this._isNonEditable(g.ev)) {
                    return false
                }
                var f = YAHOO.util.Event;
                b._setCurrentEvent(g.ev);
                var h = f.getTarget(g.ev);
                var k = false;
                if (b._hasParent(h, "table")) {
                    if (!b._hasParent(h, "td")) {
                        b.currentElement[0] = h;
                        b.toolbar.fireEvent("createtableClick", {
                            type: "createtableClick",
                            target: b.toolbar
                        });
                        b.fireEvent("afterExecCommand", {
                            type: "afterExecCommand",
                            target: b
                        });
                        k = true
                    } else {
                        b.currentElement[0] = b._hasParent(h, "td");
                        b.toolbar.fireEvent("cellpropertiesClick", {
                            type: "cellpropertiesClick",
                            target: b.toolbar
                        });
                        b.fireEvent("afterExecCommand", {
                            type: "afterExecCommand",
                            target: b
                        });
                        k = true
                    }
                }
                if (k) {
                    b.nodeChange();
                    b.fireEvent("editorDoubleClick", {
                        type: "editorDoubleClick",
                        target: b,
                        ev: g.ev
                    });
                    return false
                }
                return true
            });
            this.on("afterNodeChange",
            function() {
                if (!b.get("disabled")) {
                    var k = b.toolbar.getButtonByValue("createtable");
                    var f = b._getSelectedElement();
                    if (k) {
                        var g = true;
                        if (b.currentWindow && (b.currentWindow.name == "createtable")) {
                            g = false
                        } else {
                            if (f && b._isElement(f, "table") || b._hasParent(f, "table")) {
                                g = true
                            }
                        }
                        if (g) {
                            b.toolbar.enableButton(k)
                        } else {
                            b.toolbar.disableButton(k)
                        }
                    }
                    var o = b.toolbar.getButtonByValue("cellproperties");
                    if (o) {
                        var h = false;
                        if (f && b._isElement(f, "td") || b._hasParent(f, "td")) {
                            h = true
                        }
                        if (h) {
                            b.toolbar.enableButton(o)
                        } else {
                            b.toolbar.disableButton(o)
                        }
                    }
                    return true
                }
            })
        },
        init: function(d, b) {
            this._table = null;
            this._tableCell = null;
            this._defaultTableToolbarConfig = {
                rtl: false,
                buttonType: "advanced",
                buttons: [{
                    group: "columns",
                    label: this.STR_TABLE_COLUMNS + ":",
                    buttons: [{
                        type: "spin",
                        label: "0",
                        value: "columns",
                        range: [1, 100]
                    }]
                },
                {
                    type: "separator"
                },
                {
                    group: "cellspacing",
                    label: this.STR_TABLE_CELL_SPACING + ":",
                    buttons: [{
                        type: "spin",
                        label: "0",
                        value: "cellspacing",
                        range: [0, 100]
                    }]
                },
                {
                    type: "separator"
                },
                {
                    group: "rows",
                    label: this.STR_TABLE_ROWS + ":",
                    buttons: [{
                        type: "spin",
                        label: "0",
                        value: "rows",
                        range: [1, 100]
                    }]
                },
                {
                    type: "separator"
                },
                {
                    group: "cellpadding",
                    label: this.STR_TABLE_CELL_PADDING + ":",
                    buttons: [{
                        type: "spin",
                        label: "0",
                        value: "cellpadding",
                        range: [0, 100]
                    }]
                },
                {
                    type: "separator"
                },
                {
                    group: "tableborder",
                    label: this.STR_TABLE_BORDER + ":",
                    buttons: [{
                        type: "select",
                        title: "Border Size",
                        label: this.STR_TABLE_BORDER_SIZE,
                        value: "tablebordersize",
                        menu: [{
                            text: "none",
                            value: "0",
                            checked: true
                        },
                        {
                            text: "1px",
                            value: "1"
                        },
                        {
                            text: "2px",
                            value: "2"
                        },
                        {
                            text: "3px",
                            value: "3"
                        },
                        {
                            text: "4px",
                            value: "4"
                        },
                        {
                            text: "5px",
                            value: "5"
                        }]
                    },
                    {
                        type: "select",
                        title: "Border Type",
                        label: this.STR_TABLE_BORDER_TYPE,
                        value: "tablebordertype",
                        disabled: true,
                        menu: [{
                            text: this.STR_TEXT_SOLID,
                            value: "solid",
                            checked: true
                        },
                        {
                            text: this.STR_TEXT_DASHED,
                            value: "dashed"
                        },
                        {
                            text: this.STR_TEXT_DOTTED,
                            value: "dotted"
                        }]
                    },
                    {
                        type: "color",
                        label: this.STR_LABEL_TABLE_BORDER_COLOR,
                        value: "tablebordercolor",
                        disabled: true
                    }]
                },
                {
                    type: "separator"
                },
                {
                    group: "tablecellborder",
                    label: this.STR_TABLE_CELL_BORDER + ":",
                    buttons: [{
                        type: "select",
                        title: "Border Size",
                        label: this.STR_TABLE_CELL_BORDER_SIZE,
                        value: "tablecellbordersize",
                        menu: [{
                            text: "none",
                            value: "0",
                            checked: true
                        },
                        {
                            text: "1px",
                            value: "1"
                        },
                        {
                            text: "2px",
                            value: "2"
                        },
                        {
                            text: "3px",
                            value: "3"
                        },
                        {
                            text: "4px",
                            value: "4"
                        },
                        {
                            text: "5px",
                            value: "5"
                        }]
                    },
                    {
                        type: "select",
                        title: "Border Type",
                        label: this.STR_TABLE_CELL_BORDER_TYPE,
                        value: "tablecellbordertype",
                        disabled: true,
                        menu: [{
                            text: this.STR_TEXT_SOLID,
                            value: "solid",
                            checked: true
                        },
                        {
                            text: this.STR_TEXT_DASHED,
                            value: "dashed"
                        },
                        {
                            text: this.STR_TEXT_DOTTED,
                            value: "dotted"
                        }]
                    },
                    {
                        type: "color",
                        label: this.STR_LABEL_TABLE_CELL_BORDER_COLOR,
                        value: "tablecellbordercolor",
                        disabled: true
                    }]
                }]
            };
            this._defaultCellToolbarConfig = {
                rtl: false,
                buttonType: "advanced",
                buttons: [{
                    group: "cellborder",
                    label: this.STR_CELL_BORDER + ":",
                    buttons: [{
                        type: "select",
                        title: "Border Size",
                        label: this.STR_CELL_BORDER_SIZE,
                        value: "cellbordersize",
                        menu: [{
                            text: "none",
                            value: "0",
                            checked: true
                        },
                        {
                            text: "1px",
                            value: "1"
                        },
                        {
                            text: "2px",
                            value: "2"
                        },
                        {
                            text: "3px",
                            value: "3"
                        },
                        {
                            text: "4px",
                            value: "4"
                        },
                        {
                            text: "5px",
                            value: "5"
                        }]
                    },
                    {
                        type: "select",
                        title: "Border Type",
                        label: this.STR_CELL_BORDER_TYPE,
                        value: "cellbordertype",
                        disabled: true,
                        menu: [{
                            text: this.STR_TEXT_SOLID,
                            value: "solid",
                            checked: true
                        },
                        {
                            text: this.STR_TEXT_DASHED,
                            value: "dashed"
                        },
                        {
                            text: this.STR_TEXT_DOTTED,
                            value: "dotted"
                        }]
                    },
                    {
                        type: "color",
                        label: this.STR_CELL_BORDER_COLOR,
                        value: "cellbordercolor",
                        disabled: true
                    }]
                },
                {
                    type: "separator"
                },
                {
                    type: "separator"
                },
                {
                    group: "halignment",
                    label: this.STR_CELL_HORIZONTAL_ALIGNMENT + ":",
                    buttons: [{
                        type: "select",
                        label: this.STR_CELL_HORIZONTAL_ALIGNMENT,
                        value: "cellhalignment",
                        disabled: false,
                        menu: [{
                            text: this.STR_TEXT_LEFT,
                            value: "left",
                            checked: true
                        },
                        {
                            text: this.STR_TEXT_CENTER,
                            value: "center"
                        },
                        {
                            text: this.STR_TEXT_RIGHT,
                            value: "right"
                        }]
                    }]
                },
                {
                    type: "separator"
                },
                {
                    group: "valignment",
                    label: this.STR_CELL_VERTICAL_ALIGNMENT + ":",
                    buttons: [{
                        type: "select",
                        label: this.STR_CELL_VERTICAL_ALIGNMENT,
                        value: "cellvalignment",
                        disabled: false,
                        menu: [{
                            text: this.STR_TEXT_TOP,
                            value: "top",
                            checked: true
                        },
                        {
                            text: this.STR_TEXT_CENTER,
                            value: "center"
                        },
                        {
                            text: this.STR_TEXT_BOTTOM,
                            value: "bottom"
                        }]
                    }]
                },
                {
                    type: "separator"
                },
                {
                    group: "cellbackgroundcolor",
                    label: this.STR_CELL_BACKGROUND_COLOR + ":",
                    buttons: [{
                        type: "color",
                        label: this.STR_CELL_BACKGROUND_COLOR,
                        value: "cellbackgroundcolor",
                        disabled: false
                    }]
                },
                {
                    type: "separator"
                },
                {
                    group: "insert",
                    label: getLocalizedMessage("Insert") + ":",
                    buttons: [{
                        type: "select",
                        title: "Insert Location",
                        label: getLocalizedMessage("none"),
                        value: "insert",
                        disabled: false,
                        menu: [{
                            text: getLocalizedMessage("Column to the right"),
                            value: "insertColumnsRight",
                            checked: true
                        },
                        {
                            text: getLocalizedMessage("Column to the left"),
                            value: "insertColumnsLeft"
                        },
                        {
                            text: getLocalizedMessage("Row Above"),
                            value: "insertRowsAbove"
                        },
                        {
                            text: getLocalizedMessage("Row Below"),
                            value: "insertRowsBelow"
                        }]
                    }]
                },
                ]
            };
            RichTextWidget.superclass.init.call(this, d, b)
        },
        _renderPropertyWindows: function() {
            RichTextWidget.superclass._renderPropertyWindows.call(this);
            this._renderCreateTableWindow();
            this._renderCellPropertiesWindow()
        },
        setAttachmentPoolField: function(b) {
            if (typeof b == "undefined" || b == null) {
                this._attachmentPoolField = null;
                this.STR_IMAGE_HERE = this.STR_IMAGE_HERE_ORIG
            } else {
                this._attachmentPoolField = b;
                this.STR_IMAGE_HERE = this.STR_IMAGE_HERE_ATTACH
            }
        },
        fixWidget: function() {
            if (this.toolbar.get("disabled")) {
                this.toolbar.set("disabled", false)
            }
        },
        getAttachmentPoolField: function() {
            return this._attachmentPoolField
        },
        setText: function(d) {
            var b = updateRtfHtml(this.windowID, d);
            this.setEditorHTML(b)
        },
        getText: function() {
            this.saveHTML();
            var b = this.get("element").value;
            if (b == null) {
                return ""
            }
            return b
        },
        _setInitialContent: function() {
            var d = ((this._textarea) ? this.get("element").value: this.get("element").innerHTML);
            var b = updateRtfHtml(this.windowID, d);
            if (this._textarea) {
                this.get("element").value = b
            } else {
                this.get("element").innerHTML = b
            }
            RichTextWidget.superclass._setInitialContent.call(this)
        },
        _handleAttachmentCompleted: function(b) {
            if (this._lastAttachFieldID > 0 && this._lastAttachFieldID in getFields_NS(this.windowID)) {
                var f = getFields_NS(this.windowID)[this._lastAttachFieldID];
                var k = YAHOO.util.Dom;
                if (f && f.mObj && f.mObj.v && f.mObj.v.mDataKey) {
                    var d = JAttachment.getAttachServletURL() + "/" + new Date().getTime();
                    var h = JAttachment.getURLParams("1", f.mObj.v.mDataKey);
                    var g = d + "?ATTKey=" + h;
                    var o = k.get(this.get("id") + "_insertimage_url");
                    o.value = g;
                    this._handleImageURLChange()
                }
            }
        },
        _verifyAttachments: function(b) {
            if (b == null) {
                b = this._getDoc()
            }
            GlobalVerifyAttachments(this.windowID, b, this._attachmentPoolField)
        },
        _handleInsertImageButton: function(o) {
            var k = YAHOO.util.Dom;
            var d = YAHOO.util.Event;
            this._lastAttachFieldID = -1;
            if (this._attachmentPoolField != null || this._attachmentPoolField != "undefined") {
                var h = [];
                h = this._attachmentPoolField.GetEmptyRowIds();
                if (h.length > 0) {
                    var b = h[0];
                    var g = this;
                    if (b in getFields_NS(this.windowID)) {
                        var f = getFields_NS(this.windowID)[b];
                        g._lastAttachFieldID = b;
                        new WorkflowContext(this.windowID, {
                            f: function() {
                                var q = {};
                                var p = f.Add(q);
                                var s = p.n.f;
                                p.n.f = function(u) {
                                    s.call(f, u);
                                    g._handleAttachmentCompleted(u);
                                    g.focus()
                                };
                                return p
                            }
                        })
                    }
                }
            }
        },
        _handleInsertImageClick: function() {
            this.showInsertImageButton(this._attachmentPoolField != null);
            if (this._attachmentPoolField != null) {
                this._verifyAttachments();
                var d = this._attachmentPoolField.GetEmptyRow();
                var b = d > -1 && !((getARStateCurrent_NS(this.windowID) == 3) || (getARStateCurrent_NS(this.windowID) == 4));
                this.enableInsertImageButton(b)
            }
            return RichTextWidget.superclass._handleInsertImageClick.call(this)
        },
        destroy: function() {
            _attachmentPoolField = null;
            return RichTextWidget.superclass.destroy.call(this)
        },
        _handleInsertImageWindowClose: function() {
            var h = YAHOO.util.Dom;
            var b = h.get(this.get("id") + "_insertimage_url"),
            v = h.get(this.get("id") + "_insertimage_title"),
            u = h.get(this.get("id") + "_insertimage_link"),
            o = h.get(this.get("id") + "_insertimage_target"),
            f = arguments[0].win.el;
            if (b && b.value && (b.value != this.STR_IMAGE_HERE)) {
                var y = "?ATTKey";
                var w = v.value;
                if (b.value.indexOf(y) > 0) {
                    if (this._lastAttachFieldID > 0 && this._lastAttachFieldID in getFields_NS(this.windowID)) {
                        f.setAttribute("arattid", this._lastAttachFieldID + "");
                        f.setAttribute("arschema", ARKWGetStringByIdx(this.windowID, 6));
                        f.setAttribute("arentryid", "");
                        if (w == null || w.length == 0) {
                            var d = getFields_NS(this.windowID)[this._lastAttachFieldID];
                            if (d != null && d instanceof JAttachment && d.mObj && d.mObj.v && d.mObj.v.mFileName) {
                                w = getLocalizedMessage("Attachment Image: ");
                                w += d.mObj.v.mFileName
                            }
                        }
                    }
                } else {
                    f.setAttribute("arattid", "");
                    f.setAttribute("arschema", "");
                    if (b.value && b.value.length > 0) {
                        var s = (b.value.indexOf("\\") >= 0 ? b.value.lastIndexOf("\\") : b.value.lastIndexOf("/"));
                        if (s >= 0 && s < b.value.length && (w == null || w.length == 0)) {
                            w = getLocalizedMessage("Image: ");
                            w += b.value.substring(s)
                        }
                    }
                }
                f.setAttribute("src", b.value);
                f.setAttribute("alt", w);
                f.setAttribute("title", w);
                var p = f.parentNode;
                if (u.value) {
                    var k = u.value;
                    if ((k.indexOf("://") == -1) && (k.substring(0, 1) != "/") && (k.substring(0, 6).toLowerCase() != "mailto")) {
                        if ((k.indexOf("@") != -1) && (k.substring(0, 6).toLowerCase() != "mailto")) {
                            k = "mailto:" + k
                        } else {
                            k = "http://" + k
                        }
                    }
                    if (p && this._isElement(p, "a")) {
                        p.setAttribute("href", k);
                        if (o.checked) {
                            p.setAttribute("target", o.value)
                        } else {
                            p.setAttribute("target", "")
                        }
                    } else {
                        var q = this._getDoc().createElement("a");
                        q.setAttribute("href", k);
                        if (o.checked) {
                            q.setAttribute("target", o.value)
                        } else {
                            q.setAttribute("target", "")
                        }
                        f.parentNode.replaceChild(q, f);
                        q.appendChild(f)
                    }
                } else {
                    if (p && this._isElement(p, "a")) {
                        p.parentNode.replaceChild(f, p)
                    }
                }
            } else {
                var g = "";
                if (f.getAttribute("src")) {
                    g = f.getAttribute("src", 2)
                }
                if (g.indexOf(this.get("blankimage")) != -1 || b == null || b.value == null || b.value == this.STR_IMAGE_HERE) {
                    f.parentNode.removeChild(f)
                }
            }
            this._lastAttachFieldID = -1;
            h.get(this.get("id") + "_insertimage_url").value = "";
            h.get(this.get("id") + "_insertimage_title").value = "";
            h.get(this.get("id") + "_insertimage_link").value = "";
            h.get(this.get("id") + "_insertimage_target").checked = false;
            h.get(this.get("id") + "_insertimage_width").value = 0;
            h.get(this.get("id") + "_insertimage_height").value = 0;
            this._defaultImageToolbar.resetAllButtons();
            this.currentElement = [];
            this.nodeChange()
        },
        closeWindow: function(b) {
            if (this.currentWindow) {
                RichTextWidget.superclass.closeWindow.call(this, b)
            }
        },
        resizeWindow: function() {
            var o = this.get("element_cont").get("element");
            if (o && o.parentNode) {
                RichTextWidget.superclass.hide.call(this);
                var k = this.get("animate");
                if (k) {
                    this.set("animate", false)
                }
                if (o.parentNode.clientWidth > 0) {
                    this.set("width", o.parentNode.clientWidth + "px")
                }
                var d = o.parentNode.clientHeight,
                f = (this.toolbar.get("element").clientHeight),
                g = 0;
                if (this.dompath) {
                    if (this.dompath.clientHeight > 0) {
                        g = (this.dompath.clientHeight)
                    } else {
                        g = 18
                    }
                }
                var b = (d - f - g);
                if (b > 0) {
                    this.set("height", b + "px");
                    this.get("element_cont").setStyle("height", "")
                }
                if (k) {
                    this.set("animate", k)
                }
                RichTextWidget.superclass.show.call(this)
            }
        },
        show: function(d) {
            this._removeEditorEvents();
            this._clearUndo();
            if (d) {
                this._oldZIndex = d.parentNode.style.zIndex;
                d.parentNode.style.zIndex = 10000;
                var f = this.get("element_cont").get("element");
                d.parentNode.replaceChild(f, d)
            }
            var b = this;
            setTimeout(function() {
                b._setDesignMode("on");
                b._initEditorEvents();
                RichTextWidget.superclass.show.call(b)
            },
            1)
        },
        focus: function() {
            this._setDesignMode("on");
            this._getWindow().focus();
            var b = this;
            setTimeout(function() {
                try {
                    if (b._getWindow() != null) {
                        b._setDesignMode("on");
                        b._getWindow().focus()
                    }
                } catch(d) {}
            },
            50)
        },
        hide: function(b) {
            this._removeEditorEvents();
            this._clearUndo();
            RichTextWidget.superclass.hide.call(this);
            var d = this.get("element_cont").get("element");
            if (d.parentNode) {
                d.parentNode.style.zIndex = this._oldZIndex;
                if (b) {
                    d.parentNode.replaceChild(b, d)
                } else {
                    d.parentNode.removeChild(d)
                }
            }
        },
        _handleCreateTableClick: function() {
            if (this.get("limitCommands")) {
                if (!this.toolbar.getButtonByValue("createtable")) {
                    return false
                }
            }
            var b = function() {
                var g = YAHOO.util.Dom,
                B = YAHOO.util.Event,
                s = YAHOO.lang;
                var C = this._getDoc().getElementsByTagName("table");
                if (C && C.length) {
                    for (var h = 0; h < C.length; h++) {
                        this._table = C[h];
                        this._table.cells = this._table.getElementsByTagName("td");
                        if (this._table && this._table.className == "temp_table") {
                            this._table.className = "";
                            this.currentElement[0] = this._table;
                            this._selectNode(this._table);
                            break
                        } else {
                            this._table = null
                        }
                    }
                }
                if (this._table && this._isElement(this._table, "table")) {
                    var w = new YAHOO.widget.EditorWindow("createtable", {
                        width: "450px"
                    });
                    var u = null;
                    if (this._windows.createtable && this._windows.createtable.body) {
                        u = this._windows.createtable.body
                    } else {
                        u = this._renderCreateTableWindow()
                    }
                    w.setHeader(this.STR_TABLE_TITLE);
                    w.setBody(u);
                    tbar = this._defaultTableToolbar;
                    tbar.editor_el = this._table;
                    g.get(this.get("id") + "_createtable_width").value = parseInt(this._table.style.width, 10);
                    g.get(this.get("id") + "_createtable_height").value = parseInt(this._table.style.height, 10);
                    var A = tbar.getButtonByValue("columns");
                    A.set("label", this._getColumnCount(this._table) + "");
                    var A = tbar.getButtonByValue("rows");
                    A.set("label", this._getRowCount(this._table) + "");
                    A = tbar.getButtonByValue("cellspacing");
                    var q = this._table.getAttribute("cellSpacing");
                    if (q == null || typeof q == "undefined") {
                        q = "0"
                    }
                    A.set("label", q);
                    A = tbar.getButtonByValue("cellpadding");
                    var q = this._table.getAttribute("cellPadding");
                    if (q == null || typeof q == "undefined") {
                        q = "0"
                    }
                    A.set("label", q);
                    var v = g.get(this.get("id") + "_createtable_caption");
                    v.checked = this._table.caption != null;
                    if ("defaultChecked" in v) {
                        v.defaultChecked = (this._table.caption != null)
                    }
                    var p = this._getTableStyle(this._table);
                    var A = tbar.getButtonByValue("tablebordersize"),
                    o = ((parseInt(p.size, 10) > 0) ? "": this.STR_NONE);
                    A.set("label", '<span class="yui-toolbar-tablebordersize-' + p.size + '">' + o + "</span>");
                    this._updateMenuChecked("tablebordersize", p.size, tbar);
                    var y = tbar.getButtonByValue("tablebordertype");
                    y.set("label", '<span class="yui-toolbar-tablebordertype-' + p.type + '">asdfa</span>');
                    this._updateMenuChecked("tablebordertype", p.type, tbar);
                    if (parseInt(p.size, 10) > 0) {
                        tbar.enableButton(y);
                        tbar.enableButton("tablebordercolor")
                    } else {
                        tbar.disableButton(y);
                        tbar.disableButton("tablebordercolor")
                    }
                    var k = "0",
                    f = "solid";
                    var d = this._getTableCellStyle(this._table);
                    if (d && d.size) {
                        k = parseInt(d.size, 10)
                    }
                    if (d && d.type) {
                        f = d.type
                    }
                    A = tbar.getButtonByValue("tablecellbordersize");
                    o = ((parseInt(k, 10) > 0) ? "": this.STR_NONE);
                    A.set("label", '<span class="yui-toolbar-tablecellbordersize-' + k + '">' + o + "</span>");
                    this._updateMenuChecked("tablecellbordersize", k, tbar);
                    y = tbar.getButtonByValue("tablecellbordertype");
                    y.set("label", '<span class="yui-toolbar-tablecellbordertype-' + f + '">asdfa</span>');
                    this._updateMenuChecked("tablecellbordertype", f, tbar);
                    if (parseInt(k, 10) > 0) {
                        tbar.enableButton(y);
                        tbar.enableButton("tablecellbordercolor")
                    } else {
                        tbar.disableButton(y);
                        tbar.disableButton("tablecellbordercolor")
                    }
                    this.openWindow(w)
                }
                this.unsubscribe("afterExecCommand", b, this, true)
            };
            this.on("afterExecCommand", b, this, true)
        },
        _addRemoveRowHeader: function(g, b) {
            var f = g[g.length - 1].rows;
            var d = {};
            for (i = 0; i < f.length; i++) {
                if (b == 2) {
                    if (f[i].firstChild.nodeName == "TD") {
                        d = document.createElement("th");
                        d.innerHTML = "<strong>Row " + (i + 1) + "</strong>";
                        f[i].replaceChild(d, f[i].firstChild)
                    }
                } else {
                    d = document.createElement("th");
                    d.innerHTML = "<strong>Row " + (i + 1) + "</strong>";
                    f[i].insertBefore(d, f[i].firstChild)
                }
            }
        },
        _handleCreateTableWindowClose: function() {
            this.nodeChange()
        },
        _handleCellPropertiesClick: function() {
            if (this.get("limitCommands")) {
                if (!this.toolbar.getButtonByValue("cellproperties")) {
                    return false
                }
            }
            this.toolbar.set("disabled", false);
            var b = function() {
                var g = this.currentElement[0];
                var k = YAHOO.util.Dom,
                A = YAHOO.util.Event,
                q = YAHOO.lang;
                if (this._table && (this._table.tagName == "TABLE" || this._table.tagName == "table") && this._tableCell && (this._tableCell.tagName == "TD" || this._tableCell.tagName == "td")) {
                    var v = new YAHOO.widget.EditorWindow("cellproperties", {
                        width: "250px"
                    });
                    var s = null;
                    if (this._windows.cellproperties && this._windows.cellproperties.body) {
                        s = this._windows.cellproperties.body
                    } else {
                        s = this._renderCellPropertiesWindow()
                    }
                    v.setHeader(this.STR_CELL_PROPERTIES_TITLE);
                    v.setBody(s);
                    tbar = this._defaultCellToolbar;
                    tbar.editor_el = g;
                    var p = "0",
                    f = "solid";
                    var d = this._getTableCellStyle(this._table, this._tableCell);
                    if (d && d.size) {
                        p = parseInt(d.size, 10)
                    }
                    if (d && d.type) {
                        f = d.type
                    }
                    var y = tbar.getButtonByValue("cellbordersize");
                    var o = ((parseInt(p, 10) > 0) ? "": this.STR_NONE);
                    y.set("label", '<span class="yui-toolbar-cellbordersize-' + p + '">' + o + "</span>");
                    this._updateMenuChecked("cellbordersize", p, tbar);
                    bt_button = tbar.getButtonByValue("cellbordertype");
                    bt_button.set("label", '<span class="yui-toolbar-cellbordertype-' + f + '">asdfa</span>');
                    this._updateMenuChecked("cellbordertype", f, tbar);
                    if (parseInt(p, 10) > 0) {
                        tbar.enableButton(bt_button);
                        tbar.enableButton("cellbordercolor")
                    } else {
                        tbar.disableButton(bt_button);
                        tbar.disableButton("cellbordercolor")
                    }
                    var h = "Center",
                    u = "Left",
                    w = "";
                    w = this._tableCell.align;
                    switch (w) {
                    case "left":
                        u = "Left";
                        break;
                    case "center":
                        u = "Center";
                        break;
                    case "right":
                        u = "Right";
                        break
                    }
                    y = tbar.getButtonByValue("cellhalignment");
                    y.set("label", '<span class="yui-toolbar-cellhalignment-right">' + u + "</span>");
                    this._updateMenuChecked("cellhalignment", u.toLowerCase(), tbar);
                    w = this._tableCell.vAlign;
                    switch (w) {
                    case "top":
                        h = "Top";
                        break;
                    case "middle":
                        h = "Center";
                        break;
                    case "bottom":
                        h = "Bottom";
                        break
                    }
                    y = tbar.getButtonByValue("cellvalignment");
                    y.set("label", '<span class="yui-toolbar-cellvalignment-right">' + h + "</span>");
                    this._updateMenuChecked("cellvalignment", h.toLowerCase(), tbar);
                    y = tbar.getButtonByValue("insert");
                    y.set("label", "<span>" + getLocalizedMessage("none") + "</span>");
                    this.openWindow(v)
                }
                this.unsubscribe("afterExecCommand", b, this, true)
            };
            this.on("afterExecCommand", b, this, true)
        },
        _handleCellPropertiesWindowClose: function() {
            this.nodeChange()
        },
        _updateCellBorderProperties: function() {
            var o = this._getTableCellStyle(this._table);
            if (o != null) {
                var k = o.style;
                var f = o.size + "px ";
                var h = o.type + " ";
                var d = o.color;
                var b = f + h + d;
                var p = this._getColumnCount(this._table);
                var g = Math.round(100 / p) + "%";
                this._setTableCellStyle(this._table, k, b, g, null, null, null)
            }
        },
        _renderCreateTableWindow: function() {
            var h = YAHOO.util.Dom,
            w = YAHOO.util.Event,
            p = YAHOO.lang;
            var v = "ltr";
            if (this.get("rtl")) {
                v = "rtl"
            }
            var s = this.get("id");
            var d = this.currentElement[0];
            var u = '<div class="yui-toolbar-group yui-toolbar-group-height-width height-width"><label for="' + s + '_createtable_size"><strong>' + this.STR_IMAGE_SIZE + ":</strong>";
            u += '<span tabIndex="-1"><input type="text" size="3" value="" id="' + s + '_createtable_width"> x <input type="text" size="3" value="" id="' + s + '_createtable_height"></span>';
            u += "</label></div>";
            this._defaultTableToolbarConfig.rtl = this.get("rtl");
            var b = {};
            var g = document.createElement("div");
            g.style.width = "100%";
            g.id = s + "_tble_toolbar";
            p.augmentObject(b, this._defaultTableToolbarConfig);
            var f = new YAHOO.widget.Toolbar(g, b);
            f.editor_el = d;
            this._defaultTableToolbar = f;
            var B = f.get("cont");
            w.onAvailable(s + "_createtable_width",
            function() {
                w.on(s + "_createtable_width", "blur",
                function() {
                    var C = h.get(s + "_createtable_width");
                    if (this._table) {
                        var o = /(^-?\d\d*$)/;
                        if (o.test(C.value)) {
                            var D = parseInt(C.value, 10);
                            if (D >= 200) {
                                this._table.style.width = D + "px";
                                if (C.nextSibling.tagName == "SPAN") {
                                    C.nextSibling.style.display = "none";
                                    C.nextSibling.parentNode.removeChild(C.nextSibling)
                                }
                            } else {
                                if (D < 200) {
                                    if (C.nextSibling.tagName != "SPAN") {
                                        var E = document.createElement("span");
                                        E.innerHTML = "Enter a number greater than or equal to 200";
                                        E.style.color = "red";
                                        C.parentNode.insertBefore(E, C.nextSibling)
                                    } else {
                                        return
                                    }
                                }
                            }
                        } else {
                            if (C.nextSibling.tagName != "SPAN") {
                                var E = document.createElement("span");
                                E.innerHTML = "Enter a number greater than or equal to 200";
                                E.style.color = "red";
                                C.parentNode.insertBefore(E, C.nextSibling)
                            } else {
                                return
                            }
                        }
                        this.fireEvent("afterTablePropertiesChanged", {
                            type: "afterTablePropertiesChanged",
                            panel: this.get("panel"),
                            body: k
                        })
                    }
                },
                this, true)
            },
            this, true);
            w.onAvailable(s + "_createtable_height",
            function() {
                w.on(s + "_createtable_height", "blur",
                function() {
                    var E = h.get(s + "_createtable_height");
                    if (this._table) {
                        var o = /(^-?\d\d*$)/;
                        if (o.test(E.value)) {
                            var C = parseInt(E.value, 10);
                            if (C >= 100) {
                                this._table.style.height = C + "px";
                                if (E.nextSibling != null) {
                                    if (E.nextSibling.tagName == "SPAN") {
                                        E.nextSibling.style.display = "none";
                                        E.nextSibling.parentNode.removeChild(E.nextSibling)
                                    }
                                }
                            } else {
                                if (C < 100) {
                                    if (E.nextSibling == null) {
                                        var D = document.createElement("span");
                                        D.innerHTML = "Please Enter a number greater than or equal to 100";
                                        D.style.color = "red";
                                        E.parentNode.insertBefore(D, E.nextSibling)
                                    } else {
                                        return
                                    }
                                }
                            }
                        } else {
                            if (E.nextSibling == null) {
                                var D = document.createElement("span");
                                D.innerHTML = "Please Enter a number greater than or equal to 100";
                                D.style.color = "red";
                                E.parentNode.insertBefore(D, E.nextSibling)
                            } else {
                                return
                            }
                        }
                        this.fireEvent("afterTablePropertiesChanged", {
                            type: "afterTablePropertiesChanged",
                            panel: this.get("panel"),
                            body: k
                        })
                    }
                },
                this, true)
            },
            this, true);
            w.onAvailable(s + "_createtable_caption",
            function() {
                w.on(s + "_createtable_caption", "click",
                function() {
                    if (this._table) {
                        var o = h.get(s + "_createtable_caption").checked;
                        this._addRemoveTableCaption(this._table, o);
                        this.fireEvent("afterTablePropertiesChanged", {
                            type: "afterTablePropertiesChanged",
                            panel: this.get("panel"),
                            body: k
                        })
                    }
                },
                this, true)
            },
            this, true);
            w.onAvailable("deleteTable",
            function() {
                w.on("deleteTable", "click",
                function() {
                    if (this._table) {
                        var C = this._table.parentNode;
                        if (C != null) {
                            var o = this._table.nextSibling;
                            if (o != null && o.tagName == "P") {
                                C.removeChild(o)
                            }
                            o = null;
                            this._table.style.display = "none";
                            C.removeChild(this._table);
                            this._table = null;
                            this.currentElement[0] = null;
                            this.closeWindow()
                        }
                    }
                },
                this, true)
            },
            this, true);
            w.onAvailable("deleteTableInPlace",
            function() {
                w.on("deleteTableInPlace", "click",
                function() {
                    if (this._table) {
                        var C = this._table.parentNode;
                        if (C != null) {
                            var o = this._table.nextSibling;
                            if (o != null && o.tagName == "P") {
                                C.removeChild(o)
                            }
                            o = null;
                            this._table.style.display = "none";
                            C.removeChild(this._table);
                            this._table = null;
                            this.currentElement[0] = null;
                            this.closeWindow()
                        }
                        this.fireEvent("afterTablePropertiesChanged", {
                            type: "afterTablePropertiesChanged",
                            panel: this.get("panel"),
                            body: k
                        })
                    }
                },
                this, true)
            },
            this, true);
            f.on("colorPickerClicked",
            function(G) {
                h.get(this.get("id") + "_createtable_width").value = parseInt(this._table.style.width, 10);
                h.get(this.get("id") + "_createtable_height").value = parseInt(this._table.style.height, 10);
                if (G.button == "tablebordercolor") {
                    var E = this._getTableStyle(this._table);
                    if (E != null) {
                        var C = E.size + "px " + E.type + " #" + G.color;
                        this._setTableStyle(this._table, C, null, null);
                        this.fireEvent("afterTablePropertiesChanged", {
                            type: "afterTablePropertiesChanged",
                            panel: this.get("panel"),
                            body: k
                        })
                    }
                } else {
                    if (G.button == "tablecellbordercolor") {
                        var D = this._getTableCellStyle(this._table);
                        if (D != null) {
                            var C = D.size + "px " + D.type + " #" + G.color;
                            this._setTableCellStyle(this._table, null, C, null, null, null, null);
                            this.fireEvent("afterTablePropertiesChanged", {
                                type: "afterTablePropertiesChanged",
                                panel: this.get("panel"),
                                body: k
                            })
                        }
                    }
                }
            },
            this, true);
            f.on("buttonClick",
            function(C) {
                var O = C.button.value,
                D = "";
                if (C.button.menucmd) {
                    O = C.button.menucmd
                }
                switch (O) {
                case "tablecellbordersize":
                    var S = this._getTableCellStyle(this._table);
                    if (S != null) {
                        D = parseInt(C.button.value, 10) + "px " + S.type + " " + S.color;
                        this._setTableCellStyle(this._table, null, D, null, null, null, null);
                        if (parseInt(C.button.value, 10) > 0) {
                            f.enableButton("tablecellbordertype");
                            f.enableButton("tablecellbordercolor")
                        } else {
                            f.disableButton("tablecellbordertype");
                            f.disableButton("tablecellbordercolor")
                        }
                        this._updateMenuChecked("tablecellbordersize", O, f);
                        this.fireEvent("afterTablePropertiesChanged", {
                            type: "afterTablePropertiesChanged",
                            panel: this.get("panel"),
                            body: k
                        })
                    }
                    break;
                case "tablebordersize":
                    var G = this._getTableStyle(this._table);
                    D = parseInt(C.button.value, 10) + "px " + G.type + " " + G.color;
                    this._setTableStyle(this._table, D, null, null);
                    if (parseInt(C.button.value, 10) > 0) {
                        f.enableButton("tablebordertype");
                        f.enableButton("tablebordercolor")
                    } else {
                        f.disableButton("tablebordertype");
                        f.disableButton("tablebordercolor")
                    }
                    this._updateMenuChecked("tablebordersize", O, f);
                    this.fireEvent("afterTablePropertiesChanged", {
                        type: "afterTablePropertiesChanged",
                        panel: this.get("panel"),
                        body: k
                    });
                    break;
                case "tablebordertype":
                    var G = this._getTableStyle(this._table);
                    D = G.size + "px " + C.button.value + " " + G.color;
                    this._setTableStyle(this._table, D, null, null);
                    this._updateMenuChecked("tablebordertype", O, f);
                    this.fireEvent("afterTablePropertiesChanged", {
                        type: "afterTablePropertiesChanged",
                        panel: this.get("panel"),
                        body: k
                    });
                    break;
                case "tablecellbordertype":
                    var S = this._getTableCellStyle(this._table);
                    if (S != null) {
                        D = S.size + "px " + C.button.value + " " + S.color;
                        this._setTableCellStyle(this._table, null, D, null, null, null, null)
                    }
                    this._updateMenuChecked("tablecellbordertype", O, f);
                    this.fireEvent("afterTablePropertiesChanged", {
                        type: "afterTablePropertiesChanged",
                        panel: this.get("panel"),
                        body: k
                    });
                    break;
                case "columns":
                    var R = f.getButtonById(C.button.id);
                    var Q = parseInt(R.get("label"), 10);
                    var H = this._getColumnCount(this._table);
                    var U = Q;
                    if (H > 0) {
                        U = Q - H
                    }
                    var P = this._getTableCellPos(this._tableCell).column;
                    if (P >= 0) {
                        P = P + 1
                    }
                    this._addRemoveColumns(this._table, U, P);
                    this._updateCellBorderProperties();
                    this.fireEvent("afterTablePropertiesChanged", {
                        type: "afterTablePropertiesChanged",
                        panel: this.get("panel"),
                        body: k
                    });
                    break;
                case "rows":
                    var R = f.getButtonById(C.button.id);
                    var J = parseInt(R.get("label"), 10);
                    var N = this._getRowCount(this._table);
                    var L = J;
                    if (N > 0) {
                        L = J - N
                    }
                    var I = 0;
                    if (this._tableCell) {
                        I = this._getTableCellPos(this._tableCell).row
                    }
                    if (I >= 0) {
                        I = I + 1
                    }
                    this._addRemoveRows(this._table, L, I);
                    this._updateCellBorderProperties();
                    this.fireEvent("afterTablePropertiesChanged", {
                        type: "afterTablePropertiesChanged",
                        panel: this.get("panel"),
                        body: k
                    });
                    break;
                case "cellspacing":
                    var R = f.getButtonById(C.button.id);
                    var E = parseInt(R.get("label"), 10);
                    this._setTableStyle(this._table, null, null, E);
                    this.fireEvent("afterTablePropertiesChanged", {
                        type: "afterTablePropertiesChanged",
                        panel: this.get("panel"),
                        body: k
                    });
                    break;
                case "cellpadding":
                    var R = f.getButtonById(C.button.id);
                    var K = parseInt(R.get("label"), 10);
                    this._setTableStyle(this._table, null, K, null);
                    this.fireEvent("afterTablePropertiesChanged", {
                        type: "afterTablePropertiesChanged",
                        panel: this.get("panel"),
                        body: k
                    });
                    break
                }
                h.get(this.get("id") + "_createtable_width").value = parseInt(this._table.style.width, 10);
                h.get(this.get("id") + "_createtable_height").value = parseInt(this._table.style.height, 10);
                f.selectButton(C.button.value);
                if (O !== "padding") {
                    this.moveWindow()
                }
            },
            this, true);
            var k = document.createElement("div");
            k.innerHTML = u;
            k.appendChild(g);
            var q = document.createElement("label");
            q.setAttribute("for", s + "_createtable_caption_label");
            q.innerHTML = '<input type="checkbox" name="' + s + '_createtable_caption_" id="' + s + '_createtable_caption" value="_blank" class="insertimage_target"> ' + this.STR_TABLE_CAPTION;
            k.appendChild(q);
            var y = (this.MTYPE == "rtf_editor") ? "deleteTableInPlace": "deleteTable";
            var A = document.createElement("div");
            A.innerHTML = '<span id="' + y + '" class="yui-button yui-push-button"> <span class="first-child"> <a href="#" tabindex="-1">' + getLocalizedMessage("Delete Table") + "</a></span></span> ";
            k.appendChild(A);
            this._windows.createtable = {};
            this._windows.createtable.body = k;
            this.get("panel").editor_form.appendChild(k);
            this.fireEvent("windowCreateTableRender", {
                type: "windowCreateTableRender",
                panel: this.get("panel"),
                body: k
            });
            return k
        },
        cmd_createtable: function(d) {
            var b = this._getSelectedElement();
            this._table = null;
            this._tableCell = null;
            if (this._hasParent(b, "table")) {
                this.currentElement[0] = this._hasParent(b, "table");
                this._table = this.currentElement[0];
                this._table.className = "temp_table";
                this._tableCell = this._hasParent(b, "td")
            } else {
                var f = '<p><table class="temp_table" border="1" cellSpacing="0" cellPadding="0" style="border: 1px solid rgb(0, 0, 0); width: 200px; height: 100px;"><tbody><tr><td style="font-size:13px;" vAlign="middle" scope="row" width="50%"></td><td style="font-size:13px; vAlign="middle" width="50%"></td></tr><tr><td style="font-size:13px; vAlign="middle" scope="row" width="50%"></td><td style="font-size:13px; vAlign="middle" width="50%"></td></tr></tbody></table>&nbsp;</p>&nbsp;';
                this.execCommand("inserthtml", f)
            }
            return [false]
        },
        cmd_cellproperties: function(d) {
            var b = this._getSelectedElement();
            this._table = null;
            this._tableCell = null;
            if (this._hasParent(b, "table") && this._hasParent(b, "td")) {
                this.currentElement[0] = this._hasParent(b, "td");
                this._table = this._hasParent(b, "table");
                this._tableCell = this._hasParent(b, "td")
            }
            return [false]
        },
        _getColumnCount: function(d) {
            if (d == null || d.tagName != "TABLE") {
                return - 1
            }
            var b = 0;
            var f = d.rows;
            for (r = 0; r < f.length; r++) {
                if (b < f[r].cells.length) {
                    b = f[r].cells.length
                }
            }
            return b
        },
        _getRowCount: function(b) {
            if (b == null || b.tagName != "TABLE") {
                return - 1
            }
            return (b.rows ? b.rows.length: 0)
        },
        _getTableCellPos: function(b) {
            if (b == null || b.tagName != "TD") {
                return {
                    column: -1,
                    row: -1
                }
            }
            var f = b.cellIndex;
            var d = b.parentNode.rowIndex;
            return {
                column: f,
                row: d
            }
        },
        _addRemoveTableCaption: function(f, d) {
            if (f == null || f.tagName != "TABLE") {
                return
            }
            if (d) {
                if (f.caption) {
                    return
                }
                var b = f.createCaption();
                b.style.fontSize = 16;
                b.style.fontWeight = "bold";
                b.innerHTML = this.STR_TABLE_CAPTION;
                if (f.style != null && f.style.border) {
                    b.style.border = f.style.border
                }
            } else {
                if (f.caption) {
                    f.deleteCaption()
                }
            }
        },
        _addRemoveColumns: function(g, f, d) {
            if (g == null || g.tagName != "TABLE" || f == 0) {
                return
            }
            var h = g.rows;
            if (f > 0) {
                for (r = 0; r < h.length; r++) {
                    var k = h[r];
                    for (c = 0; c < f; c++) {
                        var b = null;
                        if (d && typeof d == "number" && d >= 0 && d < k.cells.length) {
                            b = k.insertCell(d)
                        } else {
                            b = k.insertCell(k.cells.length - 1)
                        }
                    }
                }
            } else {
                for (r = 0; r < h.length; r++) {
                    var k = h[r];
                    for (c = f; c < 0 && k.cells && k.cells.length > 1; c++) {
                        var b = null;
                        if (d && typeof d == "number" && d >= 0 && d < k.cells.length) {
                            b = k.deleteCell(d)
                        } else {
                            b = k.deleteCell(k.cells.length - 1)
                        }
                    }
                }
            }
        },
        _addRemoveRows: function(k, h, f) {
            if (k == null || k.tagName != "TABLE" || h == 0) {
                return
            }
            if (k.rows == null || (h < 0 && k.rows.length <= 1)) {
                return
            }
            var d = parseInt(k.style.height);
            if (h < 0) {
                for (r = h; r < 0 && k.rows.length > 1; r++) {
                    var o = null;
                    if (f && typeof f == "number" && f >= 0 && f < k.rows.length) {
                        o = k.rows[f];
                        d -= parseInt(o.clientHeight);
                        k.deleteRow(f)
                    } else {
                        o = k.rows[k.rows.length - 1];
                        d -= parseInt(o.clientHeight);
                        k.deleteRow(k.rows.length - 1)
                    }
                }
            } else {
                var g = this._getColumnCount(k);
                for (r = 0; r < h; r++) {
                    var o = null;
                    if (f && typeof f == "number" && f >= 0 && f < k.rows.length) {
                        o = k.insertRow(f)
                    } else {
                        o = k.insertRow(k.rows.length - 1)
                    }
                    for (c = 0; c < g && o; c++) {
                        var b = o.insertCell(0)
                    }
                    if (o) {
                        d += parseInt(o.clientHeight)
                    }
                }
            }
            k.style.height = d + "px"
        },
        _getTableBody: function(b) {
            if (b == null || b.tagName != "TABLE" || b.tBodies == null || b.tBodies.length <= 0) {
                return null
            }
            return b.tBodies[0]
        },
        _getTableStyle: function(k) {
            if (k == null || k.tagName != "TABLE") {
                return null
            }
            var b = "1",
            d = "solid",
            o = "black";
            if (k.style.borderLeftWidth) {
                b = parseInt(k.style.borderLeftWidth, 10)
            }
            if (k.style.borderLeftStyle) {
                d = k.style.borderLeftStyle
            }
            if (k.style.borderLeftColor) {
                o = k.style.borderLeftColor
            }
            var p = b + "px " + d + " #" + o;
            var h = k.getAttribute("cellPadding");
            var g = k.getAttribute("cellSpacing");
            var f = {
                size: b,
                type: d,
                color: o,
                cellpadding: h,
                cellspacing: g,
                borderstring: p,
                width: k.style.width,
                height: k.style.height
            };
            return f
        },
        _setTableStyle: function(d, b, g, f) {
            if (d == null || d.tagName != "TABLE") {
                return
            }
            if (b != null) {
                d.style.border = b
            }
            if (g != null && typeof g != "undefined") {
                d.setAttribute("cellPadding", g + "")
            }
            if (f != null && typeof f != "undefined") {
                d.setAttribute("cellSpacing", f + "")
            }
            if (d.caption && d.caption.tagName == "CAPTION") {
                d.caption.style.border = b
            }
        },
        _getTableCellStyle: function(y, h) {
            if (y == null || y.tagName != "TABLE") {
                return null
            }
            var v = "1",
            p = "solid",
            q = "black";
            var g = "",
            b = "",
            k = "",
            o = "",
            f = "",
            B = "";
            var u = null;
            if (h != null && typeof h != "undefined" && h.tagName == "TD") {
                u = h
            } else {
                if (y.rows) {
                    var d = y.rows.length;
                    if (d > 0) {
                        var A = y.rows[d - 1];
                        var w = A.cells.length;
                        if (w > 0) {
                            u = A.cells[w - 1]
                        }
                    }
                }
            }
            if (u != null) {
                g = u.getAttribute("style");
                k = u.getAttribute("width");
                o = u.getAttribute("height");
                f = u.vAlign;
                B = u.align;
                if (u.style.borderLeftWidth) {
                    v = parseInt(u.style.borderLeftWidth, 10)
                }
                if (u.style.borderLeftStyle) {
                    p = u.style.borderLeftStyle
                }
                if (u.style.borderLeftColor) {
                    q = u.style.borderLeftColor
                }
                _borderstring = v + "px " + p + " #" + q
            }
            var s = {
                style: g,
                borderString: b,
                width: k,
                height: o,
                valign: f,
                halign: B,
                size: v,
                type: p,
                color: q
            };
            return s
        },
        _setTableCellStyle: function(p, b, f, d, o, h, g) {
            if (p == null || p.tagName != "TABLE") {
                return
            }
            var q = p.cells;
            for (c = 0; c < q.length; c++) {
                var k = q[c];
                if (b != null) {
                    k.setAttribute("style", b)
                }
                if (d != null) {
                    k.setAttribute("width", d)
                }
                if (o != null) {
                    k.setAttribute("height", o)
                }
                if (h != null) {
                    k.vAlign = h
                }
                if (g != null) {
                    k.align = g
                }
                if (k.style.fontSize.length == 0) {
                    k.style.fontSize = b.fontSize
                }
                k.style.border = f
            }
        },
        _renderCellPropertiesWindow: function() {
            var p = YAHOO.util.Dom,
            w = YAHOO.util.Event,
            s = YAHOO.lang;
            var v = "ltr";
            if (this.get("rtl")) {
                v = "rtl"
            }
            var u = this.get("id");
            var d = this.currentElement[0];
            this._defaultTableToolbarConfig.rtl = this.get("rtl");
            var b = {};
            var k = document.createElement("div");
            k.style.width = "100%";
            k.id = u + "_cell_toolbar";
            s.augmentObject(b, this._defaultCellToolbarConfig);
            var g = new YAHOO.widget.Toolbar(k, b);
            g.editor_el = d;
            this._defaultCellToolbar = g;
            var A = g.get("cont");
            g.on("colorPickerClicked",
            function(D) {
                if (D.button == "cellbackgroundcolor") {
                    this._tableCell.style.backgroundColor = "#" + D.color
                } else {
                    if (D.button == "cellbordercolor") {
                        var C = this._getTableCellStyle(this._table, this._tableCell);
                        if (C != null) {
                            var B = C.size + "px " + C.type + " #" + D.color;
                            this._tableCell.style.border = B
                        }
                    }
                }
            },
            this, true);
            w.onAvailable("deleteRows",
            function() {
                w.on("deleteRows", "click",
                function() {
                    if (this._tableCell) {
                        rowIndex = this._getTableCellPos(this._tableCell).row
                    }
                    var o = parseInt(this._table.style.height);
                    var B = null;
                    if (this._table.rows.length == 1) {
                        this._table.style.display = "none";
                        this._table.parentNode.removeChild(this._table);
                        this.closeWindow()
                    }
                    B = this._table.rows[this._table.rows.length - 1];
                    o -= parseInt(B.clientHeight);
                    this._table.deleteRow(rowIndex);
                    this._table.style.height = o + "px";
                    this.closeWindow()
                },
                this, true)
            },
            this, true);
            w.onAvailable("deleteColumns",
            function() {
                w.on("deleteColumns", "click",
                function() {
                    var C = this._getTableCellPos(this._tableCell).column;
                    var B = parseInt(this._table.style.height);
                    var D = this._table.rows;
                    for (r = 0; r < D.length; r++) {
                        var E = D[r];
                        var o = null;
                        if (E.cells.length == 1) {
                            this._table.style.display = "none";
                            this._table.parentNode.removeChild(this._table);
                            this.closeWindow()
                        }
                        if (C && typeof C == "number" && C >= 0 && C < E.cells.length) {
                            o = E.deleteCell(C)
                        } else {
                            o = E.deleteCell(E.cells.length - 1)
                        }
                        B = 2 * parseInt(E.clientHeight);
                        nWidth = parseInt(E.clientWidth) / 2
                    }
                    if (C < 2) {
                        this._table.style.height = B + "px";
                        this._table.style.width = nWidth + "px"
                    }
                    this.closeWindow()
                },
                this, true)
            },
            this, true);
            g.on("buttonClick",
            function(B) {
                var H = B.button.value,
                C = "";
                if (B.button.menucmd) {
                    H = B.button.menucmd
                }
                switch (H) {
                case "cellbordersize":
                    var L = this._getTableCellStyle(this._table, this._tableCell);
                    if (L != null) {
                        C = parseInt(B.button.value, 10) + "px " + L.type + " " + L.color;
                        this._tableCell.style.border = C;
                        if (parseInt(B.button.value, 10) > 0) {
                            g.enableButton("cellbordertype");
                            g.enableButton("cellbordercolor")
                        } else {
                            g.disableButton("cellbordertype");
                            g.disableButton("cellbordercolor")
                        }
                    }
                    this._updateMenuChecked("cellbordersize", B.button.value, g);
                    break;
                case "cellbordertype":
                    var E = this._getTableCellStyle(this._table, this._tableCell);
                    C = E.size + "px " + B.button.value + " " + E.color;
                    this._tableCell.style.border = C;
                    this._updateMenuChecked("cellbordertype", B.button.value, g);
                    break;
                case "cellvalignment":
                    var K = g.getButtonById(B.button.id);
                    var D = "";
                    switch (B.button.value) {
                    case "top":
                        D = "top";
                        break;
                    case "center":
                        D = "middle";
                        break;
                    case "bottom":
                        D = "bottom";
                        break
                    }
                    this._tableCell.vAlign = D;
                    this._updateMenuChecked("cellvalignment", D, g);
                    break;
                case "cellhalignment":
                    var K = g.getButtonById(B.button.id);
                    var D = "";
                    switch (B.button.value) {
                    case "left":
                        D = "left";
                        break;
                    case "center":
                        D = "center";
                        break;
                    case "right":
                        D = "right";
                        break
                    }
                    this._tableCell.align = D;
                    this._updateMenuChecked("cellhalignment", D, g);
                    break;
                case "insert":
                    var K = g.getButtonById(B.button.id);
                    var D = "";
                    switch (B.button.value) {
                    case "insertColumnsRight":
                        colIndexPos = this._getTableCellPos(this._tableCell).column;
                        colindexPos = colIndexPos + 1;
                        var O = this._table.rows;
                        for (r = 0; r < O.length; r++) {
                            var N = O[r];
                            var J = null;
                            J = N.insertCell(colindexPos);
                            J.innerHTML = "<br>"
                        }
                        D = "insertColumnsRight";
                        break;
                    case "insertRowsBelow":
                        if (this._tableCell) {
                            rowIndex = this._getTableCellPos(this._tableCell).row;
                            var G = parseInt(this._table.style.height);
                            rowIndex = rowIndex + 1;
                            var N = null;
                            N = this._table.insertRow(rowIndex);
                            var I = this._getColumnCount(this._table);
                            for (c = 0; c < I && N; c++) {
                                var J = N.insertCell(0);
                                J.innerHTML = "<br>"
                            }
                            if (N) {
                                G += parseInt(N.clientHeight)
                            }
                            this._table.style.height = G + "px"
                        }
                        D = "insertRowsBelow";
                        break;
                    case "insertColumnsLeft":
                        colIndexPos = this._getTableCellPos(this._tableCell).column;
                        colindexPos = colIndexPos + 1;
                        var O = this._table.rows;
                        for (r = 0; r < O.length; r++) {
                            var N = O[r];
                            var J = null;
                            J = N.insertCell(colindexPos - 1);
                            J.innerHTML = "<br>"
                        }
                        D = "insertColumnsLeft";
                        break;
                    case "insertRowsAbove":
                        if (this._tableCell) {
                            rowIndex = this._getTableCellPos(this._tableCell).row
                        }
                        var G = parseInt(this._table.style.height);
                        rowIndex = rowIndex + 1;
                        var N = null;
                        N = this._table.insertRow(rowIndex - 1);
                        var I = this._getColumnCount(this._table);
                        for (c = 0; c < I && N; c++) {
                            var J = N.insertCell(0);
                            J.innerHTML = "<br>"
                        }
                        if (N) {
                            G += parseInt(N.clientHeight)
                        }
                        this._table.style.height = G + "px";
                        D = "insertRowsAbove";
                        break;
                        break
                    }
                }
                this._updateMenuChecked("insert", D, g);
                g.selectButton(B.button.value);
                if (H !== "padding") {
                    this.moveWindow()
                }
            },
            this, true);
            var q = document.createElement("div");
            q.appendChild(k);
            var y = document.createElement("div");
            y.innerHTML = "<br/>";
            q.appendChild(y);
            var h = document.createElement("div");
            h.innerHTML = '<span id="deleteRows" class="yui-button yui-push-button"> <span class="first-child"> <a href="#" tabindex="-1">' + getLocalizedMessage("Delete Row") + "</a></span></span>";
            q.appendChild(h);
            var y = document.createElement("div");
            y.innerHTML = "<br/>";
            q.appendChild(y);
            var f = document.createElement("div");
            f.innerHTML = '<span id="deleteColumns" class="yui-button yui-push-button"> <span class="first-child"> <a href="#" tabindex="-1">' + getLocalizedMessage("Delete Column") + "</a></span></span>";
            q.appendChild(f);
            this._windows.cellproperties = {};
            this._windows.cellproperties.body = q;
            this.get("panel").editor_form.appendChild(q);
            this.fireEvent("windowcellpropertiesRender", {
                type: "windowcellpropertiesRender",
                panel: this.get("panel"),
                body: q
            });
            return q
        }
    })
}
RichTextEditor.prototype.constructor = RichTextEditor;
function RichTextEditor(b, d) {
    if (arguments.length) {
        this.init(b, d)
    }
}
RichTextEditor.prototype.init = function(b, d) {
    this.mEditor = null;
    this.mEditing = null;
    this.mID = d;
    this.mSingleLine = false;
    this.mField = null;
    this.mShift = false;
    this.mHidden = false;
    this.mTarget = null;
    this.firstKeyUp = false;
    this.windowID = b
};
RichTextEditor.prototype.OnBeforeEditorKeyDown = function(f) {
    if (f != null && f.ev != null) {
        switch (f.ev.keyCode) {
        case 27:
            var d = this;
            setTimeout(function() {
                d.Close(true)
            },
            5);
            return false;
        case 13:
            if (this.mSingleLine) {
                var b = YAHOO.util.Event;
                b.stopEvent(f.ev);
                return false
            }
            break;
        case 16:
            this.mShift = true;
            break;
        case 9:
            var g = this.mField;
            if (g != null) {
                var d = this;
                setTimeout(function() {
                    d.Close(true);
                    setTimeout(function() {
                        var h = new FormEvent(g.windowID, g.mID);
                        if (d.mShift) {
                            h.shift = true;
                            FocusMgr.SetFocusToPrevious(h)
                        } else {
                            FocusMgr.SetFocusToNext(h)
                        }
                    },
                    5)
                },
                5)
            }
            return false
        }
        return true
    }
};
RichTextEditor.prototype.OnBeforeEditorKeyPress = function(d) {
    if (d != null && d.ev != null) {
        switch (d.ev.keyCode) {
        case 13:
            if (this.mSingleLine) {
                var b = YAHOO.util.Event;
                b.stopEvent(d.ev);
                return false
            }
            break
        }
        return true
    }
};
RichTextEditor.prototype.OnBeforeEditorKeyUp = function(d) {
    if (d != null && d.ev != null) {
        switch (d.ev.keyCode) {
        case 16:
            this.mShift = false;
            break;
        case 13:
            if (!this.mSingleLine) {
                var b = YAHOO.util.Event;
                b.stopEvent(d.ev);
                return false
            }
            break;
        case 9:
            return false
        }
        return true
    }
};
RichTextEditor.prototype.OnEditorKeyUp = function(d) {
    var f = this.GetText();
    if (this.mField && this.mField.mInputNode && !this.firstKeyUp && f && this.RTFValChanged(f)) {
        this.mField.SetDirty(this.mField.mInputNode);
        this.firstKeyUp = true
    }
    if (d != null && d.ev != null && d.ev.keyCode == 13) {
        var b = this;
        new WorkflowContext(b.windowID, {
            f: function(g) {
                var h = b.mField.mInputNode;
                var k = false;
                if ("actb_autoCompleted" in h) {
                    if (h.actb_autoCompleted) {
                        k = true;
                        h.actb_autoCompleted = false
                    }
                }
                if (!k) {
                    promptBar.setToClear();
                    return ExecuteWorkflow(b.windowID, 2, b.mField.mID)
                }
            },
            t: b.mField,
            a: [d]
        })
    }
};
RichTextEditor.prototype.OnEditorKeyDown = function(b) {};
RichTextEditor.prototype.AfterExecCommand = function() {
    var b = this.mEditor.currentElement[0];
    if (this.mField && this.mField.mInputNode) {
        if (this.mEditor._hasParent(b, "table")) {
            this.mField.SetDirty(this.mField.mInputNode)
        }
    }
};
RichTextEditor.prototype.CreateRTFWidget = function(h) {
    var g = YAHOO.util.Dom;
    var b = YAHOO.util.Event;
    var f = {
        maxUndo: 0,
        insertImageButton: true,
        css: "html{height: 95%;} body{height: 100%;padding: 2px; background-color: #fff; font:11px/1.03 arial,helvetica,clean,sans-serif;} a{color: blue;text-decoration: underline;cursor: pointer;} .warning-localfile{border-bottom: 1px dashed red !important;} .yui-busy{cursor: wait !important;} img.selected{border: 2px dotted #808080;} img{cursor: pointer !important; border: none;}",
        height: "100%",
        width: "100%",
        animate: false,
        resize: true,
        dompath: true,
        focusAtStart: false,
        limitCommands: false,
        toolbar: {
            titlebar: false,
            collapse: true,
            buttons: [{
                group: "fontstyle",
                label: "",
                buttons: [{
                    type: "select",
                    title: "Font Name",
                    label: "Arial",
                    value: "fontname",
                    disabled: true,
                    menu: [{
                        text: "Arial",
                        checked: true
                    },
                    {
                        text: "Arial Black"
                    },
                    {
                        text: "Comic Sans MS"
                    },
                    {
                        text: "Courier New"
                    },
                    {
                        text: "Lucida Console"
                    },
                    {
                        text: "Tahoma"
                    },
                    {
                        text: "Times New Roman"
                    },
                    {
                        text: "Trebuchet MS"
                    },
                    {
                        text: "Verdana"
                    }]
                },
                {
                    type: "spin",
                    title: "Font Size",
                    label: "13",
                    value: "fontsize",
                    range: [9, 75],
                    disabled: true
                }]
            },
            {
                type: "separator"
            },
            {
                group: "textstyle",
                label: "",
                buttons: [{
                    type: "push",
                    label: getLocalizedMessage("Bold") + " (Ctrl + Shift + B)",
                    value: "bold"
                },
                {
                    type: "push",
                    label: getLocalizedMessage("Italic") + " (Ctrl + Shift + I )",
                    value: "italic"
                },
                {
                    type: "push",
                    label: getLocalizedMessage("Underline") + " (Ctrl + Shift + U)",
                    value: "underline"
                },
                {
                    type: "separator"
                },
                {
                    type: "color",
                    label: getLocalizedMessage("Font Color"),
                    value: "forecolor",
                    disabled: true
                },
                {
                    type: "color",
                    label: getLocalizedMessage("Background Color"),
                    value: "backcolor",
                    disabled: true
                }]
            }]
        }
    };
    YAHOO.widget.Toolbar.prototype.STR_COLLAPSE = getLocalizedMessage("Click to close the editor.");
    this.mEditor = new RichTextWidget(this.windowID, this.mID, f, null);
    var d = this;
    this.mEditor.on("toolbarLoaded",
    function() {
        this.toolbar.on("toolbarCollapsed",
        function() {
            d.Close(true);
            g.removeClass(this.toolbar.get("cont").parentNode, "yui-toolbar-container-collapsed")
        },
        this, true)
    },
    this.mEditor, true);
    this.mEditor.on("beforeEditorKeyDown", d.OnBeforeEditorKeyDown, this, true);
    this.mEditor.on("beforeEditorKeyUp", d.OnBeforeEditorKeyUp, this, true);
    this.mEditor.on("editorKeyUp", d.OnEditorKeyUp, this, true);
    this.mEditor.on("afterTablePropertiesChanged", d.AfterExecCommand, this, true);
    this.mEditor.on("afterOpenWindow", d.AfterOpenWindow, this, true);
    this.mEditor.render();
    this.mHidden = false
};
RichTextEditor.prototype.AfterOpenWindow = function(h, d) {
    var g = h.panel;
    var f = g.element;
    if (h != null && g != null && f != null) {
        if (parseInt(f.style.left) < 0) {
            f.style.left = "5px"
        }
        var b = this.mEditor.toolbar.get("element").clientHeight;
        if (parseInt(f.style.top) < b) {
            b = b + 10;
            f.style.top = b + "px"
        }
    }
};
RichTextEditor.prototype.RTFValChanged = function(d) {
    var b = this.mField.GetRTFVal();
    if (b == null) {
        b = ""
    }
    if (!compareHtml(d, b)) {
        return true
    }
    return false
};
RichTextEditor.prototype.Close = function(f) {
    if (this.IsVisible()) {
        GlobalFindURL(this.mEditor);
        var d = this.GetText();
        var b = this;
        setTimeout(function() {
            b.HideWindow()
        },
        2);
        this.Reset();
        if (f && this.mField != null && this.mField.mInputNode != null) {
            if (this.RTFValChanged(d)) {
                this.mField.SetScreenValue(d);
                this.mField.SetDirty(this.mField.mInputNode)
            } else {
                this.mField.SetRTFVal(d)
            }
        }
    }
    this.mEditing = null;
    this.mField = null
};
RichTextEditor.prototype.GetEditor = function() {
    return this.mEditor
};
RichTextEditor.prototype.GetCurrentTarget = function() {
    return this.mEditing
};
RichTextEditor.prototype.SetHeight = function(b) {
    var d = "";
    if (! (typeof b == "string")) {
        d = b + "px"
    } else {
        d = b
    }
    this.mEditor.set("height", d)
};
RichTextEditor.prototype.HideWindow = function() {
    if (!this.mHidden) {
        this.mEditor.closeWindow(false);
        var b = this.mEditor.get("element_cont").get("element");
        b.style.visibility = "hidden";
        b.style.top = -9999;
        b.style.left = -9999;
        if (getFormContext(this.windowID)) {
            if (getSplitterPane_NS(this.windowID) != null) {
                getSplitterPane_NS(this.windowID).ResetZIndex()
            }
            if (getResultsListPane_NS(this.windowID) != null) {
                getResultsListPane_NS(this.windowID).ResetZIndex()
            }
            if (getToolBarPane_NS(this.windowID) != null) {
                getToolBarPane_NS(this.windowID).ResetZIndex()
            }
        }
        this.mHidden = true
    }
};
RichTextEditor.prototype.SetText = function(b) {
    this.mEditor.setText(b)
};
RichTextEditor.prototype.GetText = function() {
    this.mEditor.saveHTML();
    var b = this.mEditor.getText();
    return b
};
RichTextEditor.prototype.ShowWindow = function() {
    if (this.mHidden) {
        var b = this.mEditor.get("element_cont").get("element");
        if (this.mTarget != null) {
            b.style.zIndex = ++nextZIndex
        }
        if (getSplitterPane_NS(this.windowID) != null) {
            getSplitterPane_NS(this.windowID).SetNewZIndex(++nextZIndex)
        }
        if (getResultsListPane_NS(this.windowID) != null) {
            getResultsListPane_NS(this.windowID).SetNewZIndex(++nextZIndex)
        }
        if (getToolBarPane_NS(this.windowID) != null) {
            getToolBarPane_NS(this.windowID).SetNewZIndex(++nextZIndex)
        }
        b.style.visibility = "visible";
        this.mHidden = false
    }
};
RichTextEditor.prototype.SetWidth = function(d) {
    var b = "";
    if (! (typeof d == "string")) {
        b = d + "px"
    } else {
        b = d
    }
    this.mEditor.set("width", b)
};
RichTextEditor.prototype.SetXY = function(d) {
    var b = YAHOO.util.Dom;
    b.setXY(this.mEditor.get("element_cont").get("element"), d)
};
RichTextEditor.prototype.Focus = function() {
    if (!this.mHidden) {
        this.mEditor.focus()
    }
};
RichTextEditor.prototype.UpdatePos = function() {
    if (this.mEditing != null) {
        var b = YAHOO.util.Dom;
        var d = b.getXY(this.mEditing);
        this.SetXY(d)
    }
};
RichTextEditor.prototype.Show = function(u, y) {
    if (this.mEditing == u) {
        this.mEditor.focus();
        return
    }
    this.firstKeyUp = false;
    this.mShift = false;
    this.mField = y;
    var k = this.mField.GetScreenValue();
    var o = YAHOO.util.Dom;
    var A = YAHOO.util.Event;
    var v = y.isRTFAdvanced();
    if (typeof v != "boolean" || v == null) {
        v = false
    }
    var p = y.getRTFAttachmentFieldID();
    var q = null;
    if (p > 0 && p in getFields_NS(this.windowID)) {
        q = getFields_NS(this.windowID)[p]
    }
    this.mEditor.setAttachmentPoolField(q);
    this.mEditor.set("maxLength", parseInt(y.mMaxLen), true);
    this.mSingleLine = u.className.indexOf(" sr ") >= 0;
    if (u.id != "div" && o.hasClass(u, "rtf")) {
        this.mEditing = u;
        var C = o.getXY(u);
        var b = parseInt(u.style.width);
        var h = parseInt(u.style.height);
        this.Replace(u);
        this.HideWindow();
        this.SetToolbarVisible(v);
        this.SetXY(C);
        this.SetWidth(b);
        var w = h;
        if (v) {
            var f = 0;
            if (this.mEditor.dompath) {
                if (this.mEditor.dompath.clientHeight <= 0) {
                    f = 21
                } else {
                    f = this.mEditor.dompath.clientHeight + 1
                }
            }
            var d = (this.mEditor.toolbar.get("element").clientHeight + 2);
            w = (h - d - f);
            if (w <= 24) {
                w = h;
                this.SetToolbarVisible(false);
                this.mEditor.set("dompath", false)
            }
        } else {
            if (w <= 24) {
                w = h
            }
        }
        this.SetHeight(w);
        this.SetXY(C);
        var s = this.mEditor.get("element_cont").get("element").getElementsByTagName("iframe");
        for (var g = 0; g < s.length; g++) {
            s[g].parentNode.style.overflow = (this.mSingleLine ? "hidden": "visible");
            s[g].style.overflow = (this.mSingleLine ? "hidden": "visible");
            s[g].setAttribute("scrolling", (this.mSingleLine ? "no": "auto"));
            s[g].style.overflow = (this.mSingleLine ? "hidden": "visible");
            s[g].style.width = (this.mSingleLine ? "1000%": "100%")
        }
        var B = this;
        setTimeout(function() {
            B.ShowWindow();
            if (k == null) {
                k = ""
            }
            B.SetText(k);
            B.mEditor.focus();
            B.mEditor.fixWidget()
        },
        100)
    }
};
RichTextEditor.prototype.SetToolbarVisible = function(f) {
    var d = "";
    if (!f) {
        d = "none"
    }
    var b = this.mEditor.toolbar.get("element");
    if (b != null && b.style.display != d) {
        b.style.display = d
    }
    if (this.mEditor.dompath && this.mEditor.dompath.style.display != d) {
        this.mEditor.dompath.style.display = d
    }
};
RichTextEditor.prototype.IsVisible = function() {
    return this.mEditing != null
};
RichTextEditor.prototype.Replace = function(b) {
    if (this.mTarget != null) {
        this.Reset()
    }
    this.mTarget = b
};
RichTextEditor.prototype.Reset = function() {
    this.SetText("")
};
RichTextEditPopup.prototype = new DIVPopup();
RichTextEditPopup.prototype.constructor = RichTextEditPopup;
RichTextEditPopup.superclass = DIVPopup.prototype;
var currentRTFPopup = null;
function GlobalFindURL(d) {
    var b = d._getSelectedElement();
    d._findURL(b);
    d.innerHTML = b.innerHTML
}
function GetRTFPopup(b) {
    if (currentRTFPopup == null) {
        currentRTFPopup = new RichTextEditPopup(b);
        currentRTFPopup.SetOrigin();
        currentRTFPopup.SetContents()
    } else {
        if (currentRTFPopup.IsVisible()) {
            currentRTFPopup.OnOK()
        }
        currentRTFPopup.RefreshContents(b)
    }
    return currentRTFPopup
}
RichTextEditPopup.prototype.CreateRTFWidget = function(f) {
    if (this.popupEditor) {
        return
    }
    var d = null;
    var b = [];
    b.push({
        f: function() {
            if (ShowWaitCursor()) {
                d = new NDXRequest();
                d.showRunning()
            }
            return {}
        },
        t: this
    });
    b.push({
        f: function() {
            var o = YAHOO.util.Dom;
            var g = YAHOO.util.Event;
            var k = {
                maxUndo: 0,
                insertImageButton: true,
                css: "body{font:11px/1.03 arial,helvetica,clean,sans-serif;}",
                animate: false,
                dompath: true,
                resize: true,
                focusAtStart: true
            };
            var h = new RichTextWidget(this.windowID, f, k, null);
            this.popupEditor = h;
            h._defaultToolbar.buttonType = "advanced";
            h.on("afterOpenWindow",
            function(y, q) {
                var w = y.panel;
                var u = w.element;
                if (y != null && w != null && u != null) {
                    var v = u.style;
                    if (parseInt(v.left) < 0) {
                        v.left = "1px"
                    }
                    var p = this.toolbar.get("element").clientHeight;
                    if (parseInt(v.top) < p) {
                        p = p + 20;
                        v.top = p + "px"
                    }
                }
                if (currentRTFPopup && currentRTFPopup.IsVisible()) {
                    var s = currentRTFPopup.GetOKButton();
                    if (s && s.disabled) {
                        s.disabled = false
                    }
                }
            },
            h, true);
            h.on("editorContentLoaded",
            function() {
                h.unsubscribeAll("editorContentLoaded");
                if (d) {
                    d.hideRunning()
                }
                var p = this.get("element_cont").get("element");
                p.style.left = "0px";
                p.style.top = "0px";
                p.style.borderLeft = "0px";
                p.style.borderRight = "0px";
                p.style.borderTop = "0px";
                p.style.borderBottom = "0px";
                this.dompath.style.backgroundColor = "#dee0e0";
                this.dompath.style.height = "5px";
                this.on("editorKeyDown",
                function() {
                    if (currentRTFPopup && currentRTFPopup.IsVisible()) {
                        var q = currentRTFPopup.GetOKButton();
                        if (q && q.disabled) {
                            q.disabled = false
                        }
                    }
                },
                this, true);
                setTimeout(function() {
                    h.resizeWindow();
                    h.focus()
                },
                5)
            },
            h, true);
            h.on("toolbarLoaded",
            function() {
                this.toolbar.on("buttonClick",
                function() {
                    if (currentRTFPopup && currentRTFPopup.IsVisible()) {
                        var p = currentRTFPopup.GetOKButton();
                        if (p && p.disabled) {
                            p.disabled = false
                        }
                        return true
                    }
                },
                this, true);
                this.toolbar.on("colorPickerClicked",
                function() {
                    if (currentRTFPopup && currentRTFPopup.IsVisible()) {
                        var p = currentRTFPopup.GetOKButton();
                        if (p && p.disabled) {
                            p.disabled = false
                        }
                        return true
                    }
                },
                this, true);
                this.toolbar.on("fontsizeClick",
                function() {
                    if (currentRTFPopup && currentRTFPopup.IsVisible()) {
                        var p = currentRTFPopup.GetOKButton();
                        if (p && p.disabled) {
                            p.disabled = false
                        }
                        return true
                    }
                },
                this, true)
            },
            h, true);
            h.render();
            currentRTFPopup.UpdateAttachmentField();
            return {}
        },
        t: this
    });
    new WorkflowContext(this.windowID, b)
};
function RichTextEditPopup(b) {
    if (arguments.length) {
        this.init(b)
    }
}
RichTextEditPopup.prototype.PopupBodyStyle = "DIVPopupBodyNoBorder";
RichTextEditPopup.prototype.init = function(b) {
    this.mTarget = null;
    this.popupEditor = null;
    this.mField = b;
    this.mTXTAreaDiv = null;
    this.mIFrameDiv = null;
    this.mReadOnly = b.GAccess() == 1;
    RichTextEditPopup.superclass.init.call(this, b.windowID, false, true, true, true, true);
    this.SetSize(720, 385)
};
RichTextEditPopup.prototype.IsVisible = function() {
    return (this.mDiv.style.visibility == "visible")
};
RichTextEditPopup.prototype.RefreshContents = function(s) {
    var k = "popup";
    var p = "handle";
    var h = "title";
    if (this.mField != null) {
        var d = this.mField.mID;
        if (d == 0) {
            d = this.mField.mInputNode.id
        }
        k += d;
        p += d;
        h += d
    }
    var o = document.getElementById(k);
    var f = document.getElementById(p);
    var u = document.getElementById(h);
    this.mField = s;
    this.mReadOnly = (s.GAccess() == 1);
    if (this.mField != null) {
        var d = this.mField.mID;
        if (d == 0) {
            d = this.mField.mInputNode.id
        }
        if (o != null) {
            o.id = "popup" + d
        }
        if (f != null) {
            f.id = "handle" + d
        }
        if (u != null) {
            u.id = "title" + d
        }
    }
    var b = (getARStateCurrent_NS(this.windowID) == 4) ? getARTitles_NS(this.windowID).pluralLong: getARTitles_NS(this.windowID).singleLong;
    if (b == "") {
        b = ARKWGetStringByIdx(this.windowID, 6)
    }
    var q = getLocalizedMessage("{0} ({1}) -- {2}", [b, ARKWGetStringByIdx(this.windowID, 7), this.mField.GLabel()]);
    this.ChangeTitle(q);
    var v = this.mField.GetScreenValue();
    if (v == null) {
        v = ""
    }
    if (!this.mReadOnly) {
        this.UpdateAttachmentField();
        this.SetText(v);
        var g = this.popupEditor;
        g.fixWidget();
        setTimeout(function() {
            g.resizeWindow()
        },
        2)
    } else {
        this.SetText(v)
    }
};
RichTextEditPopup.prototype.SetContents = function() {
    var h = this.mField.GetScreenValue();
    if (h == null) {
        h = ""
    }
    var g = 1;
    var f = [];
    var k = "editor_popup";
    this.mTextId = k;
    f.push(RichTextEditPopup.GetTextareaMarkup(k, g++, this.mField.GAccess() == 1, h));
    var b = (getARStateCurrent_NS(this.windowID) == 4) ? getARTitles_NS(this.windowID).pluralLong: getARTitles_NS(this.windowID).singleLong;
    if (b == "") {
        b = ARKWGetStringByIdx(this.windowID, 6)
    }
    var d = getLocalizedMessage("{0} ({1}) -- {2}", [b, ARKWGetStringByIdx(this.windowID, 7), this.mField.GLabel()]);
    RichTextEditPopup.superclass.SetContents.call(this, d, f.join(""));
    this.mDiv.style.overflow = "visible";
    this.mTXTAreaDiv = document.getElementById("maintextareadiv_rtf");
    this.mIFrameDiv = document.getElementById("ronlyiframediv_rtf");
    if (this.popupEditor == null) {
        this.mDiv.style.visibility = "hidden";
        this.CreateRTFWidget(k);
        this.mDiv.style.visibility = "visible";
        this.mTarget = null
    }
    if (this.mReadOnly) {
        this.SetText(h)
    }
};
RichTextEditPopup.prototype.UpdateAttachmentField = function() {
    var d = this.mField.getRTFAttachmentFieldID();
    var b = null;
    if (d > 0 && d in getFields_NS(this.windowID)) {
        b = getFields_NS(this.windowID)[d]
    }
    this.popupEditor.setAttachmentPoolField(b);
    this.popupEditor.set("maxLength", parseInt(this.mField.mMaxLen), true)
};
RichTextEditPopup.prototype.OnResize = function(d, g, h, b) {
    var f = this.popupEditor;
    if (h != b || g != d) {
        setTimeout(function() {
            f.resizeWindow()
        },
        5)
    }
    RichTextEditPopup.superclass.OnResize.call(d, g, h, b)
};
RichTextEditPopup.prototype.OnStartDrag = function() {
    RichTextEditPopup.superclass.OnStartDrag.call()
};
RichTextEditPopup.prototype.OnEndDrag = function() {
    RichTextEditPopup.superclass.OnEndDrag.call()
};
RichTextEditPopup.prototype.ChangeTitle = function(b) {
    var g = "title";
    if (this.mField != null) {
        if (this.mField.mID != 0) {
            g += this.mField.mID
        } else {
            g += this.mField.mInputNode.id
        }
    }
    var f = document.getElementById(g);
    if (f != null) {
        var d = f.firstChild;
        if (d != null && d.className.indexOf("title") != -1) {
            d.innerHTML = (b.HTMLEncode() + "&nbsp;&nbsp;&nbsp;")
        }
    }
};
RichTextEditPopup.GetTextareaMarkup = function(h, d, f, g) {
    var b = [];
    b.push("<div style='z-index:100001;overflow:visible;position:relative;width:100%;height:100%;'>");
    b.push("<div id='maintextareadiv_rtf' style='z-index:100001;overflow:visible;position:absolute;top:0px;left:0px;width:100%;height:100%;'>");
    b.push("<textarea id='" + h + "' name='" + h + "' style='width:100%;height:100%;'>");
    b.push(g);
    b.push("</textarea>");
    b.push("</div>");
    b.push("<div id='ronlyiframediv_rtf' style='z-index:0;overflow:visible;position:absolute;top:0px;left:0px;width:100%;height:100%;visibility:hidden'>");
    b.push("</div>");
    b.push("</div>");
    return b.join("")
};
RichTextEditPopup.prototype.Click = function(b) {
    this.SetFocus();
    if ((b.element.parentNode.id || b.element.id) == "ardivpcancel") {
        this.OnCancel()
    }
    return false
};
RichTextEditPopup.prototype.SetFocus = function() {
    if (getOpenDIVPopup_NS(this.windowID) != this && getOpenDIVPopup_NS(this.windowID) != null) {
        var d = getCharEditPopups_NS(this.windowID).length;
        var b = 0;
        if (d > 0) {
            b = parseInt(getCharEditPopups_NS(this.windowID)[d - 1].mDiv.style.zIndex)
        }
        getOpenDIVPopup_NS(this.windowID).mDiv.style.zIndex = b;
        this.mDiv.style.zIndex = b + 1;
        for (var f = 0; f < d; f++) {
            if (this == getCharEditPopups_NS(this.windowID)[f]) {
                getCharEditPopups_NS(this.windowID).splice(f, 1)
            }
        }
        getCharEditPopups_NS(this.windowID).push(this)
    }
    setOpenDIVPopup_NS(this.windowID, this)
};
RichTextEditPopup.prototype.GetEditor = function() {
    return this.popupEditor
};
RichTextEditPopup.prototype.ShowCentredPopup = function(d) {
    var g = this.GetPosition();
    var b = getCharEditPopups_NS(this.windowID).length;
    g.x += b * 10;
    g.y += b * 15;
    getCharEditPopups_NS(this.windowID).push(this);
    this.ShowPopup(document.body, g.x, g.y, d);
    if ("external" in top) {
        try {
            top.external.ShowTextEditor()
        } catch(f) {}
    }
};
RichTextEditPopup.prototype.HidePopup = function(b) {
    this.mField.mRichTextEditBox = null;
    getCharEditPopups_NS(this.windowID).pop();
    if (getCharEditPopups_NS(this.windowID).length > 1) {
        setOpenDIVPopup_NS(this.windowID, getCharEditPopups_NS(this.windowID)[getCharEditPopups_NS(this.windowID).length - 1])
    }
    if (this.popupEditor != null) {
        this.Reset()
    }
    this.mDiv.style.visibility = "hidden";
    this.mDiv.style.top = -999;
    this.mDiv.style.left = -999
};
RichTextEditPopup.prototype.GetOKButton = function() {
    var d = this.mDiv.getElementsByTagName("button");
    for (var b = 0; b < d.length; b++) {
        if (d[b].id == "ardivpok") {
            return d[b]
        }
    }
};
RichTextEditPopup.prototype.GetCancelButton = function() {
    var d = this.mDiv.getElementsByTagName("button");
    for (var b = 0; b < d.length; b++) {
        if (d[b].id == "ardivpcancel") {
            return d[b]
        }
    }
};
RichTextEditPopup.prototype.KeyPress = function(b) {
    if (b.key == 27) {
        this.OnCancel()
    }
    return true
};
RichTextEditPopup.prototype.KeyDown = function(b) {
    return true
};
RichTextEditPopup.prototype.ShowPopup = function(g, h, d, b) {
    var p = this.GetOKButton();
    var q = this.GetCancelButton();
    var f = this.mDiv.getElementsByTagName("button");
    for (var o = 0; o < f.length; o++) {
        if (f[o].id == "ardivpcancel") {
            f[o].onclick = function(s) {}
        }
    }
    var k = getCharEditPopups_NS(this.windowID).length;
    getCharEditPopups_NS(this.windowID).push(this);
    RichTextEditPopup.superclass.ShowPopup.call(this, g, h, d, b);
    if (p) {
        p.disabled = true
    }
    if (q) {
        q.disabled = false
    }
    p.style.visibility = (this.mReadOnly) ? "hidden": "visible";
    this.mDiv.style.overflow = "visible";
    if (!this.IsVisible()) {
        this.mDiv.style.visibility = "visible"
    }
};
RichTextEditPopup.prototype.ShowSingle = function() {
    return false
};
RichTextEditPopup.prototype.OnOK = function() {
    var f = this.popupEditor;
    if (f != null) {
        f._verifyAttachments();
        GlobalFindURL(f);
        f.closeWindow(false);
        var d = this.GetText();
        var b = this.mField.GetScreenValue();
        if (b == null) {
            b = ""
        }
        if (d != b) {
            this.mField.SetScreenValue(d);
            this.mField.SetDirty(this.mField.mInputNode)
        }
    }
    this.HidePopup(false)
};
RichTextEditPopup.prototype.OnCancel = function() {
    if (this.popupEditor != null) {
        try {
            var d = this.mField.GetIFrameDoc();
            if (d != null) {
                this.popupEditor._verifyAttachments(d)
            }
        } catch(b) {}
        this.popupEditor.closeWindow(false)
    }
    this.HidePopup(false)
};
RichTextEditPopup.prototype.InitFocus = function() {};
RichTextEditPopup.prototype.NewTextAvail = function() {
    var d = this.GetOKButton();
    var b = this.popupEditor;
    if (d && !d.disabled && b != null) {
        if (this.GetText() != this.mField.mInputNode.value) {
            return true
        }
    }
    return false
};
RichTextEditPopup.prototype.GetText = function() {
    if (this.mReadOnly) {
        return this.GetReadOnlyVal()
    } else {
        if (this.popupEditor != null) {
            this.popupEditor.saveHTML();
            var b = this.popupEditor.getText();
            return b
        }
    }
    return null
};
RichTextEditPopup.prototype.BringIFrameToTop = function() {
    this.mTXTAreaDiv.style.visibility = "hidden";
    this.mTXTAreaDiv.style.zIndex = 0;
    this.mIFrameDiv.style.visibility = "visible";
    this.mIFrameDiv.style.zIndex = ++nextZIndex
};
RichTextEditPopup.prototype.BringTextareaToTop = function() {
    this.mIFrameDiv.style.visibility = "hidden";
    this.mIFrameDiv.style.zIndex = 0;
    this.mTXTAreaDiv.style.visibility = "visible";
    this.mTXTAreaDiv.style.zIndex = ++nextZIndex
};
RichTextEditPopup.prototype.SetText = function(d) {
    if (this.mReadOnly) {
        this.BringIFrameToTop();
        this.SetReadOnlyVal(d)
    } else {
        if (this.popupEditor != null) {
            this.BringTextareaToTop();
            var b = this.popupEditor;
            setTimeout(function() {
                if (d == null) {
                    d = ""
                }
                b.setText(d);
                b.getText();
                b.focus()
            },
            5)
        }
    }
};
RichTextEditPopup.prototype.Replace = function(b) {
    if (this.mTarget != null) {
        this.Reset()
    }
    this.popupEditor.show(b);
    this.mTarget = b
};
RichTextEditPopup.prototype.Reset = function() {
    this.popupEditor.setText("");
    if (this.mTarget) {
        this.popupEditor.hide(this.mTarget);
        this.mTarget = null
    }
};
RichTextEditPopup.prototype.SetReadOnlyVal = function(d) {
    if (this.mReadOnly) {
        this.InitReadOnlyFrame();
        var b = this.GetIFrameDoc();
        if (b) {
            b.body.innerHTML = d
        }
        this.mReadOnlyVal = d
    }
};
RichTextEditPopup.prototype.GetReadOnlyVal = function() {
    if (this.mReadOnly) {
        if (typeof this.mReadOnlyVal != "undefined" && this.mReadOnlyVal) {
            return this.mReadOnlyVal
        }
        var b = this.GetIFrameDoc();
        if (b) {
            return b.body.innerHTML
        }
    }
    return ""
};
RichTextEditPopup.prototype.GetIFrameDoc = function() {
    if (this.mReadOnly && typeof this.mIFrame != "undefined" && this.mIFrame != null) {
        if (this.mIFrame.contentWindow) {
            if (this.mIFrame.contentWindow.document) {
                return this.mIFrame.contentWindow.document
            }
        }
    }
    return null
};
RichTextEditPopup.prototype.InitReadOnlyFrame = function() {
    if (this.mReadOnly) {
        var b = YAHOO.util.Dom,
        q = YAHOO.util.Event,
        g = YAHOO.lang;
        if (this.mIFrameDiv == null) {
            return
        }
        this.mIFrameDiv.innerHTML = "";
        this.mIFrame = this.CreateIFrame("");
        this.mIFrameDiv.appendChild(this.mIFrame);
        var h = '<html dir="{DIRECTION}"><head><title>{TITLE}</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><base href=""><style>{CSS}</style><style>{HIDDEN_CSS}</style><style>{EXTRA_CSS}</style></head><body onload="document.body._rteLoaded = true;">{CONTENT}</body></html>';
        var o = "ltr";
        var d = "html { height: 100%; width: 100% } body { padding: 0px; background-color: #fff; font: 11px/1.03 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; }";
        var k = "";
        var f = "";
        h = g.substitute(h, {
            DIRECTION: o,
            TITLE: "",
            CONTENT: "",
            CSS: d,
            HIDDEN_CSS: k,
            EXTRA_CSS: f
        });
        var p = this.GetIFrameDoc();
        if (p != null) {
            p.open();
            p.write(h);
            p.close()
        }
    }
};
RichTextEditPopup.prototype.CreateIFrame = function(f) {
    var g = YAHOO.util.Dom,
    q = YAHOO.util.Event,
    k = YAHOO.lang;
    var b = document.createElement("iframe");
    b.id = this.mField.mID + "_iframe";
    var p = "ltr";
    var d = {
        title: f,
        dir: p,
        border: "0",
        frameBorder: "0",
        marginWidth: "0",
        marginHeight: "0",
        rightMargin: "3px",
        leftMargin: "2px",
        topMargin: "3px",
        bottomMargin: "0px",
        allowTransparency: "true",
        width: "100%",
        height: "100%",
        display: "none",
        visibility: "visible"
    };
    for (var h in d) {
        if (k.hasOwnProperty(d, h) && d[h]) {
            b.setAttribute(h, d[h])
        }
    }
    var o = "javascript:;";
    b.setAttribute("src", o);
    return b
};
FileEditPopup.prototype = new DIVPopup();
FileEditPopup.prototype.constructor = FileEditPopup;
FileEditPopup.superclass = DIVPopup.prototype;
var FileEditPopups;
function FileEditPopup(b) {
    if (arguments.length) {
        this.init(b)
    }
}
FileEditPopup.prototype.init = function(b) {
    this.mField = b;
    FileEditPopup.superclass.init.call(this, b.windowID, true, true, true, false, true);
    this.SetSize(0, 140)
};
FileEditPopup.prototype.SetContents = function() {
    var k = this.mField.G();
    var h = 1;
    var f = h++;
    var g = [];
    g.push('<form class="FileForm" enctype="multipart/form-data" method="post" action="">');
    g.push('<span class="FileSelect">File Path:</span>');
    g.push('<div class="OverflowAuto">');
    g.push('<input type="file" name="fupload" id="fupload" size="50" artb=' + f + (this.mField.GAccess() == 1 ? " readonly": "") + " class='" + (this.mField.GAccess() == 1 ? "readonly'>": "'>"));
    g.push("</div>");
    g.push("</form>");
    var b = (getARStateCurrent_NS(this.windowID) == 4) ? getARTitles_NS(this.windowID).pluralLong: getARTitles_NS(this.windowID).singleLong;
    if (b == "") {
        b = ARKWGetStringByIdx(this.windowID, 6)
    }
    var d = getLocalizedMessage("{0} ({1}) -- {2}", [b, ARKWGetStringByIdx(this.windowID, 7), this.mField.GLabel()]);
    FileEditPopup.superclass.SetContents.call(this, d, g.join(""));
    this.mDiv.style.width = "auto"
};
FileEditPopup.GetTitleMarkup = function(b) {
    return "<Div class='PopupEditorTitle'><span>" + b + "</span></Div>"
};
FileEditPopup.prototype.Click = function(b) {
    if (b.element.id == "fupload") {
        return true
    }
    return false
};
FileEditPopup.prototype.SetFocus = function() {
    var b = this.GetEditor();
    if (b != null) {
        b.focus()
    }
};
FileEditPopup.prototype.GetEditor = function() {
    var d = this.mDiv.getElementsByTagName("input");
    for (var b = 0; b < d.length; b++) {
        if (d[b].id == "fupload") {
            return d[b]
        }
    }
    return null
};
FileEditPopup.prototype.KeyDown = function(b) {
    return true
};
FileEditPopup.prototype.KeyPress = function(b) {
    if (b.key == 27) {
        this.HidePopup();
        return false
    }
    if (b.key == 13 || b.key == 32) {
        b.element.click();
        return false;
        return
    }
};
FileEditPopup.prototype.ShowCentredPopup = function(b) {
    var f = this.GetPosition();
    this.ShowPopup(document.body, f.x, f.y, b);
    if ("external" in top) {
        try {
            top.external.ShowFileEditor()
        } catch(d) {}
    }
};
FileEditPopup.prototype.HidePopup = function(b) {
    this.mField.mFileEditBox = null;
    FileEditPopup.superclass.HidePopup.call(this, true)
};
FileEditPopup.prototype.OnOK = function() {
    var d = this.GetEditor();
    if (d != null) {
        var b = d.value;
        if (b != this.mField.mInputNode.value) {
            this.mField.SetScreenValue(b);
            this.mField.SetDirty(this.mField.mInputNode)
        }
    }
    this.HidePopup(true)
};
FileEditPopup.prototype.ShowPopup = function(g, f, b, d) {
    FileEditPopup.superclass.ShowPopup.call(this, g, f, b, d);
    if ("external" in top) {
        try {
            top.external.ShowFileEditor()
        } catch(h) {}
    }
};
FileEditPopup.prototype.InitFocus = function() {
    this.GetEditor().focus()
};
QuickReportsMenu.prototype = new Menu();
QuickReportsMenu.prototype.constructor = QuickReportsMenu;
QuickReportsMenu.superclass = Menu.prototype;
function QuickReportsMenu(b) {
    if (arguments.length) {
        this.init(b)
    }
}
QuickReportsMenu.prototype.init = function(b) {
    var d = [];
    this.mName = getLocalizedMessage("My Reports");
    QuickReportsMenu.superclass.init.call(this, b, d)
};
QuickReportsMenu.prototype.Open = function(g, b) {
    var d = [];
    this.mMenuDef = [];
    var f;
    for (f in getquickReportsExisting_NS(this.windowID)) {
        if (getquickReportsExisting_NS(this.windowID)[f].d == 0) {
            d.push({
                l: f.HTMLEncode(),
                v: (" new WorkflowContext (" + this.windowID + ",{f:QuickReports.RunReport, a:[" + this.windowID + ",'" + f.EscapeQuote() + "']})")
            })
        }
    }
    this.mMenuDef.push({
        l: getLocalizedMessage("Run ...").JScriptEncode(),
        v: (d.length == 0 ? "": d),
        s: (d.length == 0 ? 0 : 1)
    });
    this.mMenuDef.push({
        l: getLocalizedMessage("Save ...").JScriptEncode(),
        v: "CreateQuickReport",
        s: (quickReportParamURL.length == 0 ? 0 : 1)
    });
    this.mMenuDef.push({
        l: getLocalizedMessage("Manage ...").JScriptEncode(),
        v: "ManageQuickReport",
        s: (getquickReportsExisting_NS(this.windowID).length == 0 ? 0 : 1)
    });
    return {
        n: {
            f: QuickReportsMenu.superclass.Open,
            t: this,
            a: [g, b, 30100, false]
        }
    }
};
QuickReports.prototype.lastRun = null;
var quickReportParamURL = "";
var quickReportParamSearch = "";
var quickReportRegularSearch = "";
var quickReportAdvancedSearchQual = "";
var quickReportSchema = "";
function QuickReports(b) {
    this.RecentSize = b
}
QuickReportsMenu.prototype.HandleSelection = function(val) {
    if (val == "CreateQuickReport") {
        if (getCurWFC_NS(this.windowID) != null) {
            return {
                n: {
                    f: this.OpenSaveQuickReportsPopup,
                    t: this
                }
            }
        } else {
            new WorkflowContext(this.windowID, {
                f: this.OpenSaveQuickReportsPopup,
                t: this
            })
        }
    } else {
        if (val == "ManageQuickReport") {
            if (getCurWFC_NS(this.windowID) != null) {
                return {
                    n: {
                        f: this.OpenManageQuickReportsPopup,
                        t: this
                    }
                }
            } else {
                new WorkflowContext(this.windowID, {
                    f: this.OpenManageQuickReportsPopup,
                    t: this
                })
            }
        } else {
            if (getCurWFC_NS(this.windowID) != null) {
                return {
                    n: {
                        f: eval,
                        a: [val],
                        t: this
                    }
                }
            } else {
                eval(val)
            }
        }
    }
};
QuickReportsMenu.prototype.OpenSaveQuickReportsPopup = function() {
    var g = {};
    var f = [];
    for (var d in getquickReportsExisting_NS(this.windowID)) {
        f.push(d.HTMLEncode())
    }
    var b = this.windowID;
    return {
        n: {
            f: function() {
                if (g.result.v && g.result.v != -1) {
                    var p = g.result.v;
                    var u = (p in getquickReportsExisting_NS(b)) ? false: true;
                    var h = quickReportParamURL.indexOf("\\");
                    var o = quickReportParamURL.substr(0, h - 2);
                    var v = quickReportParamURL.substring(h - 1, quickReportParamURL.length - 2);
                    var k = (v.length + "").length;
                    o = quickReportParamURL.substr(0, h - 2 - k);
                    var q = quickReportParamSearch + ";" + quickReportRegularSearch + ";" + quickReportAdvancedSearchQual;
                    var s = new NDXSaveQuickReport(b, p.toString(), quickReportSchema, ARKWGetStringByIdx(b, 7), o + ";" + q, u, false, false, new Array());
                    if (s.result == 1) {
                        quickReportParamURL = "";
                        quickReportParamSearch = "";
                        quickReportRegularSearch = "";
                        if (getcurQuickReportSize_NS(b) < getmaxQuickReportSize_NS(b)) {
                            getquickReportsExisting_NS(b)[p] = {
                                d: 0,
                                u: o + ";" + q
                            };
                            getUDDHolderById(b).curQuickReportSize++
                        } else {
                            getquickReportsExisting_NS(b)[p] = {
                                d: 0
                            }
                        }
                    }
                }
            },
            a: [g]
        },
        c: {
            f: function() {
                return SaveQuickReportPopup(b, g, f)
            }
        }
    }
};
QuickReportsMenu.prototype.OpenManageQuickReportsPopup = function() {
    var g = {};
    var f = [];
    var h = {};
    h.h = [getLocalizedMessage("Report Name"), getLocalizedMessage("State")];
    h.r = [];
    var d;
    for (d in getquickReportsExisting_NS(this.windowID)) {
        h.r.push({
            i: d,
            d: [{
                v: d
            },
            {
                v: (getquickReportsExisting_NS(this.windowID)[d].d == 1 ? getLocalizedMessage("Disable") : getLocalizedMessage("Enable"))
            }]
        })
    }
    var b = this.windowID;
    return {
        n: {
            f: function() {
                if ("v" in g.result && g.result.v != -1) {
                    var q = {};
                    var k = [];
                    for (d in getquickReportsExisting_NS(b)) {
                        if (typeof g.result.v[d] != "undefined" && getquickReportsExisting_NS(b)[d].d != g.result.v[d]) {
                            q[d] = g.result.v[d]
                        }
                        if (! (d in g.result.v)) {
                            k.push(d)
                        }
                    }
                    var p = [],
                    o = [];
                    for (d in q) {
                        getquickReportsExisting_NS(b)[d].d = q[d];
                        p.push(d);
                        o.push(q[d])
                    }
                    if (p.length > 0) {
                        var u = new NDXModifyQuickReport(b, ARKWGetStringByIdx(b, 7), ARKWGetStringByIdx(b, 6), p, o)
                    }
                    if (k.length > 0) {
                        var u = new NDXDeleteQuickReport(b, ARKWGetStringByIdx(b, 7), ARKWGetStringByIdx(b, 6), k);
                        if (u.result == 1) {
                            for (var s = 0; s < k.length; s++) {
                                if (getquickReportsExisting_NS(b)[k[s]].u.length > 0) {
                                    getUDDHolderById(b).curQuickReportSize--
                                }
                                delete getquickReportsExisting_NS(b)[k[s]]
                            }
                        }
                    }
                }
            },
            a: [g]
        },
        c: {
            f: function() {
                return ManageQuickReportPopup(b, g, h)
            }
        }
    }
};
QuickReports.getInputSaveToFile = function(d) {
    var b = d.split(";");
    return b[0]
};
QuickReports.RunReport = function(windowID, reportname) {
    var reporturl = getquickReportsExisting_NS(windowID)[reportname.toString()].u;
    var result = {};
    if ((typeof reporturl == "undefined") || ((typeof reporturl != "undefined") && reporturl.length == 0)) {
        var req = new NDXSaveQuickReport(windowID, reportname.toString(), ARKWGetStringByIdx(windowID, 6), ARKWGetStringByIdx(windowID, 7), "", false, true, false, []);
        result = req.result
    } else {
        result.a = reporturl
    }
    var res = {};
    var menuDef = [];
    if (result != null) {
        var params = result.a.split(";");
        return {
            n: {
                f: function() {
                    var regfl = {};
                    var searchStr1 = "",
                    searchStr2 = "";
                    if (params[2] && params[2].length > 0) {
                        var curpos = 0,
                        paramArr = [],
                        curStr = params[2],
                        remainStr = "";
                        do {
                            var begin = curStr.indexOf("/");
                            var id = curStr.substring(0, begin);
                            paramArr.push(id);
                            remainStr = curStr.substr(begin + 1);
                            var second = remainStr.indexOf("/");
                            var strlen = remainStr.substring(0, second);
                            curpos = second + parseInt(strlen);
                            var value = remainStr.substring(second + 1, curpos + 1);
                            regfl[id] = value;
                            curStr = remainStr.substr(curpos + 2)
                        } while ( curStr . length > 0 );
                        var obj = new NDXSaveQuickReport(windowID, reportname.toString(), ARKWGetStringByIdx(windowID, 6), ARKWGetStringByIdx(windowID, 7), "", false, false, false, paramArr).result;
                        obj = eval(obj);
                        searchStr1 = qbeMatchString(windowID, obj.a, regfl, 0)
                    }
                    if (res && res.result && res.result.v && res.result.v != null) {
                        var paramArr = [];
                        for (id in res.result.v) {
                            var f = getFields_NS(windowID)[id];
                            var v = res.result.v[id].toString();
                            if (f) {
                                paramArr.push(id)
                            } else {
                                var reg = new RegExp("\\$" + id + "\\$", "g");
                                params[3] = params[3].replace(reg, v);
                                delete res.result.v[id]
                            }
                        }
                        var obj = new NDXSaveQuickReport(windowID, reportname.toString(), ARKWGetStringByIdx(windowID, 6), ARKWGetStringByIdx(windowID, 7), "", false, false, false, paramArr).result;
                        obj = eval(obj);
                        if (obj && obj.a) {
                            searchStr2 = qbeMatchString(windowID, obj.a, res.result.v, 1)
                        }
                    }
                    var searchStr = (searchStr1.length > 0) ? (searchStr1 + (searchStr2.length > 0 ? " AND " + searchStr2: "")) : (searchStr2);
                    searchStr = (searchStr.length > 0) ? (params[3].length > 0 ? searchStr + " AND " + params[3] : searchStr) : (params[3].length > 0 ? params[3] : "");
                    searchStr = new NDXParseAndEncodeQualifier(windowID, ARKWGetStringByIdx(windowID, 7), ARKWGetStringByIdx(windowID, 6), ARKWGetStringByIdx(windowID, 17), searchStr).result;
                    result.a = MakeReportKey(ARKWGetStringByIdx(windowID, 6)) + MakeReportKey(ARKWGetStringByIdx(windowID, 7)) + MakeReportKey(ARKWGetStringByIdx(windowID, 17)) + params[0] + searchStr.length + "/" + searchStr + "0/";
                    if (result.a.search(/to-screen/) != -1) {
                        return {
                            c: {
                                f: ReportToScreen,
                                a: [windowID, true, result.a, ARKWGetStringByIdx(windowID, 7)]
                            }
                        }
                    } else {
                        if (result.a.search(/to-file/) != -1) {
                            var toFileStr = "to-file: ";
                            var initFn = QuickReports.getReportFileName(result.a);
                            return {
                                n: {
                                    f: function() {
                                        if ("v" in res.result && res.result.v != -1) {
                                            var url;
                                            var reportFile = QuickReports.getInputSaveToFile(res.result.v);
                                            var firstpart = result.a;
                                            if (reportFile == initFn) {
                                                url = result.a
                                            } else {
                                                var initPart = firstpart.split(toFileStr);
                                                var firstPartBeforeToFile = initPart[0];
                                                var secondPart = initPart[1];
                                                var initFnLoc = secondPart.indexOf(initFn);
                                                var initFnLen = initFnLoc + initFn.length;
                                                secondPart = secondPart.substring(initFnLen);
                                                var curtofileLength = initFn.length + toFileStr.length;
                                                var curtofileLengthStr = curtofileLength + "";
                                                var curtofileLength = curtofileLength + curtofileLengthStr.length + 1;
                                                var tofileLoc = firstpart.lastIndexOf(toFileStr);
                                                tofileLoc -= curtofileLengthStr.length + 1;
                                                firstpart = firstpart.substring(0, tofileLoc);
                                                var newtofileLength = toFileStr.length + reportFile.length;
                                                var newtofileLengthStr = newtofileLength + "";
                                                var newtofileStr = newtofileLengthStr + "/" + toFileStr + reportFile;
                                                url = firstpart + newtofileStr + secondPart
                                            }
                                            return {
                                                c: {
                                                    f: ReportToFile,
                                                    a: [windowID, url, ARKWGetStringByIdx(windowID, 7)]
                                                }
                                            }
                                        }
                                    },
                                    a: [res]
                                },
                                c: {
                                    f: function() {
                                        return ReportToFilePopup(windowID, res, menuDef, initFn)
                                    }
                                }
                            }
                        } else {
                            return {
                                c: {
                                    f: ReportToScreen,
                                    a: [windowID, true, result.a, ARKWGetStringByIdx(windowID, 7)]
                                }
                            }
                        }
                    }
                },
                a: [res]
            },
            c: {
                f: function() {
                    var paramfl;
                    if (params[1] || params[3]) {
                        if (params[1].length > 0) {
                            var tokens = params[1].split("/");
                            var len = tokens.length;
                            for (var i = 0; i < len;) {
                                var vals = tokens[i + 1].split("$");
                                if (vals != null) {
                                    if (paramfl == null) {
                                        paramfl = {}
                                    }
                                    paramfl[tokens[i]] = vals[1]
                                }
                                i = i + 2
                            }
                        }
                        if (params[3].length > 0) {
                            var tok = params[3].match(SavedSearches.PSP);
                            if (tok != null) {
                                for (var i = 0; i < tok.length; i++) {
                                    var val = tok[i];
                                    val = val.substring(1, val.length - 1);
                                    if (!ARKWIsKeywordOrEscapedKeyword(val)) {
                                        if (paramfl == null) {
                                            paramfl = new Object()
                                        }
                                        paramfl[val] = val
                                    }
                                }
                            }
                        }
                        if (paramfl) {
                            return ParamSearchPopup(windowID, res, paramfl)
                        } else {
                            return
                        }
                    } else {
                        return
                    }
                }
            }
        }
    }
};
function qbeMatchString(h, k, b, s) {
    var g = "",
    q = 0;
    for (id in b) {
        var d = 0;
        var p = F(h, id);
        var o = true;
        if (p.mDataType == 2 || p.mDataType == 3 || p.mDataType == 10) {
            o = false
        }
        if (id in k) {
            d = k[id]
        }
        var u = "";
        if (d == 1) {
            u = "'" + id + "' LIKE \"%" + b[id] + '%"'
        } else {
            if (d == 2) {
                u = "'" + id + "' LIKE \"" + b[id] + '%"'
            } else {
                if (o) {
                    u = "'" + id + "' = \"" + b[id] + '"'
                } else {
                    u = "'" + id + "' = " + b[id]
                }
            }
        }
        if (q != 0) {
            g += " AND "
        }
        g += u;
        q++
    }
    return g
}
var start = 0;
QuickReports.getReportFileName = function(d) {
    var b = "to-file:";
    var h = true;
    var k = "";
    while (h) {
        pStr = QuickReports.next(d);
        if (pStr.search(/to-file/) != -1) {
            var g = pStr.indexOf(b, 0);
            var f = g + b.length;
            k = pStr.substring(f);
            return k.trim(1 | 2)
        }
    }
    return k
};
QuickReports.next = function(g) {
    var f = g.indexOf("/", start);
    var b = 0;
    b = g.substring(start, f);
    f++;
    start = Number(f) + Number(b);
    var d = g.substring(f, start);
    return d
};
function SaveQuickReportPopup(b, g, f) {
    var k = getLocalizedMessage("Save or Redefine My Report");
    var d = getLocalizedMessage("My Report Name");
    var h = getLocalizedMessage("Enter a new name, or select existing report to redefine");
    return weOpenModalPopup(b, (AbsContextPath + "resources/html/SaveQuickReportPopup.html"), "SaveQuickReport", {
        title: k,
        appss: GetAppStyleSheet("../../"),
        label: d,
        name: name,
        menu: f,
        desc: h,
        prefs: PREFS
    },
    g, [400, 175])
}
function ReportToFilePopup(d, h, g, b) {
    var o = getLocalizedMessage("Save or Redefine My Report");
    var f = getLocalizedMessage("Report File Name");
    var k = getLocalizedMessage("Enter a report file name to save as a file");
    return weOpenModalPopup(d, (AbsContextPath + "resources/html/SaveQuickReportPopup.html"), "ReportToFileQuickReport", {
        title: o,
        appss: GetAppStyleSheet("../../"),
        label: f,
        name: name,
        menu: g,
        desc: k,
        ifname: b
    },
    h, [400, 150])
}
function ManageQuickReportPopup(b, d, f) {
    var g = getLocalizedMessage("Manage My Report");
    return weOpenModalPopup(b, (AbsContextPath + "resources/html/ManageSearchPopup.html"), "ManageQuickReport", {
        title: g,
        appss: GetAppStyleSheet("../../"),
        l: f
    },
    d, [400, 250])
}
YAHOO.util.DragDropMgr.clickTimeThresh = 2147483647;
function MidTierDDProxy(f, b, d) {
    this.stopPropagationOld = null;
    this.lastDropTarget = null;
    MidTierDDProxy.superclass.constructor.apply(this, arguments)
}
MidTierDDProxy.startDragHandler = function(b) {
    var d = Field_FromElement(b.element);
    MidTierDragDropMgrInst.lastDragSourceElement = null;
    if (d) {
        MidTierDragDropMgrInst.setLastDragSourceFieldID("" + d.mID);
        MidTierDragDropMgrInst.lastDragSourceWinID = d.windowID;
        new WorkflowContext(d.windowID, {
            f: function() {
                var f = {};
                f.c = {
                    t: d,
                    f: d.DOMDragStart,
                    a: [b]
                };
                return f
            }
        })
    }
    return true
};
YAHOO.extend(MidTierDDProxy, YAHOO.util.DDProxy, {
    onMouseDown: function(f) {
        this.stopPropagationOld = YAHOO.util.DragDropMgr.stopPropagation;
        YAHOO.util.DragDropMgr.stopPropagation = false;
        var b = Window_FromElement(f);
        var d = new FormEvent(b, f);
        MidTierDragDropMgrInst.lastMouseDownFormEvent = d;
        MidTierDragDropMgrInst.lastMouseDownElement = d.element
    },
    onMouseUp: function(b) {
        FormEvent.lastMouseDownEvent = null;
        MidTierDragDropMgrInst.lastMouseDownFormEvent = null;
        if (this.stopPropagationOld != null) {
            YAHOO.util.DragDropMgr.stopPropagation = this.stopPropagationOld;
            this.stopPropagationOld = null
        }
    },
    startDrag: function(p, k) {
        if (this.targets != null) {
            return
        }
        var b = MidTierDragDropMgrInst.lastMouseDownElement;
        MidTierDragDropMgrInst.lastDragSourceElement = b;
        FormEvent.lastMouseDownEvent.element = MidTierDragDropMgrInst.lastDragSourceElement;
        MidTierDDProxy.startDragHandler(FormEvent.lastMouseDownEvent);
        var d = Field_FromElement(b);
        this.mExecuteDragWorkflow(d);
        var g = this.getDragEl();
        MidTierDragDropMgrInst.setDragProxyValidDrop(false);
        this.iPageX = p;
        this.iPageY = k;
        YAHOO.util.Dom.addClass(g, "dndproxy");
        YAHOO.util.Dom.setStyle(g, "width", "");
        YAHOO.util.Dom.setStyle(g, "height", "");
        this.originalStyles = [];
        var o = YAHOO.util.DDM.getRelated(this, true);
        this.targets = [];
        this.targetsToUnlock = [];
        for (var h = 0; h < o.length; h++) {
            var f = o[h];
            var s = f.getEl();
            var q = Field_FromElement(s);
            if (!q.IsDOMVisible()) {
                if (!f.isLocked()) {
                    this.targetsToUnlock.push(f);
                    f.lock()
                }
                continue
            }
            if (q instanceof DView) {
                MidTierDragDropMgrInst.createDropTargetProxy(s)
            }
            if (f.isLocked()) {
                continue
            }
            this.targets.push(f);
            this.originalStyles[s.id] = {
                borderBottomStyle: s.style.borderBottomStyle,
                borderLeftStyle: s.style.borderLeftStyle,
                borderRightStyle: s.style.borderRightStyle,
                borderTopStyle: s.style.borderTopStyle,
                borderBottomWidth: s.style.borderBottomWidth,
                borderLeftWidth: s.style.borderLeftWidth,
                borderRightWidth: s.style.borderRightWidth,
                borderTopWidth: s.style.borderTopWidth,
                borderBottomColor: s.style.borderBottomColor,
                borderLeftColor: s.style.borderLeftColor,
                borderRightColor: s.style.borderRightColor,
                borderTopColor: s.style.borderTopColor
            };
            YAHOO.util.Dom.setStyle(s, "border", "2px solid");
            YAHOO.util.Dom.setStyle(s, "border-color", "#2188C9 #196697 #196697 #2188C9")
        }
    },
    mExecuteDragWorkflow: function(d) {
        var b = [];
        b.push({
            f: ExecuteWorkflow,
            a: [d.windowID, 134217728, d.mID]
        });
        if (getCurWFC_NS(d.windowID)) {
            getCurWFC_NS(d.windowID).execute(b)
        } else {
            promptBar.setToClear();
            new WorkflowContext(d.windowID, b)
        }
    },
    endDrag: function(g) {
        if (this.targets == null) {
            this.lastDropTarget = null;
            return
        }
        if (this.lastDropTarget != null) {
            this.animateValidDrop();
            MidTierDragDropMgrInst.setLastDropTargetFieldID("" + this.lastDropTarget.mID);
            this.mExecuteDropWorkflow(this.lastDropTarget);
            this.lastDropTarget = null
        } else {
            this.animateInvalidDrop()
        }
        MidTierDragDropMgrInst.removeDropTargetProxies();
        var d = this.getDragEl();
        YAHOO.util.Dom.setStyle(d, "visibility", "visible");
        for (var b = 0; b < this.targets.length; b++) {
            var h = this.targets[b].getEl();
            var k = this.originalStyles[h.id];
            h.style.borderBottomStyle = k.borderBottomStyle;
            h.style.borderLeftStyle = k.borderLeftStyle;
            h.style.borderRightStyle = k.borderRightStyle;
            h.style.borderTopStyle = k.borderTopStyle;
            h.style.borderBottomWidth = k.borderBottomWidth;
            h.style.borderLeftWidth = k.borderLeftWidth;
            h.style.borderRightWidth = k.borderRightWidth;
            h.style.borderTopWidth = k.borderTopWidth;
            h.style.borderBottomColor = k.borderBottomColor;
            h.style.borderLeftColor = k.borderLeftColor;
            h.style.borderRightColor = k.borderRightColor;
            h.style.borderTopColor = k.borderTopColor
        }
        this.targets = null;
        for (var b = 0; b < this.targetsToUnlock.length; b++) {
            var f = this.targetsToUnlock[b];
            f.unlock()
        }
        this.targetsToUnlock = null
    },
    onDragDrop: function(h, o) {
        var d = Window_FromElement(h);
        var g = new FormEvent(d, h);
        if (g.element.id.indexOf("proxy") != -1) {
            var f = g.element.id.substring(5, g.element.id.length);
            if (o != f) {
                return
            }
        } else {
            var b = Field_FromElement(MidTierDragDropMgrInst.lastMouseUpElement);
            if (b != null) {
                if (o != b.mObj.id) {
                    return
                }
            }
        }
        var k = document.getElementById(o);
        this.lastDropTarget = Field_FromElement(k)
    },
    mExecuteDropWorkflow: function(d) {
        var b = [];
        b.push({
            f: ExecuteWorkflow,
            a: [d.windowID, 268435456, d.mID]
        });
        if (getCurWFC_NS(d.windowID)) {
            getCurWFC_NS(d.windowID).execute(b)
        } else {
            new WorkflowContext(d.windowID, b)
        }
    },
    onInvalidDrop: function(b) {
        this.animateInvalidDrop()
    },
    animateValidDrop: function() {
        var d = this.getDragEl();
        var b = d.offsetWidth;
        var g = d.offsetHeight;
        var f = new YAHOO.util.Anim(d, {
            width: {
                from: b,
                to: 0
            },
            height: {
                from: g,
                to: 0
            }
        },
        0.15, YAHOO.util.Easing.easeNone);
        f.animate();
        f.onComplete.subscribe(function(h) {
            YAHOO.util.Dom.setStyle(d, "visibility", "hidden");
            YAHOO.util.Dom.setStyle(d, "width", "");
            YAHOO.util.Dom.setStyle(d, "height", "")
        })
    },
    animateInvalidDrop: function() {
        var d = this.getDragEl();
        YAHOO.util.Dom.setStyle(d, "visibility", "visible");
        var b = YAHOO.util.Dom.getXY(d);
        var f = new YAHOO.util.Anim(d, {
            left: {
                from: b[0],
                to: this.iPageX
            },
            top: {
                from: b[1],
                to: this.iPageY
            }
        },
        0.15, YAHOO.util.Easing.easeOut);
        f.animate();
        f.onComplete.subscribe(function(g) {
            YAHOO.util.Dom.setStyle(d, "visibility", "hidden")
        })
    },
    alignElWithMouse: function(b, f, d) {
        YAHOO.util.Dom.setXY(b, [f + 5, d + 15], false)
    },
    onDragEnter: function(b, d) {
        this.onDragEnterOverHelper(b, d)
    },
    onDragOver: function(b, d) {
        this.onDragEnterOverHelper(b, d)
    },
    onDragEnterOverHelper: function(h, k) {
        var g;
        var d = MidTierDragDropMgrInst.lastMouseOverElement.id;
        if (d.indexOf("proxy") != -1) {
            var f = d.substring(5, d.length);
            g = MidTierDragDropMgrInst.getDropTargetHandleById(f) != null
        } else {
            var b = Field_FromElement(MidTierDragDropMgrInst.lastMouseOverElement);
            g = b != null && MidTierDragDropMgrInst.getDropTargetHandleByNode(b.mObj) != null
        }
        MidTierDragDropMgrInst.setDragProxyValidDrop(g)
    },
    onDragOut: function(b, d) {
        MidTierDragDropMgrInst.setDragProxyValidDrop(false)
    }
});
function MidTierDDTarget(f, b, d) {
    MidTierDDTarget.superclass.constructor.apply(this, arguments)
}
YAHOO.extend(MidTierDDTarget, YAHOO.util.DDTarget, {});
function MidTierDragDropMgr() {
    this.dragSourceHandles = [];
    this.dropTargetHandles = [];
    this.dropTargetProxies = [];
    this.lastDragSourceFieldID = null;
    this.lastDragSourceWinID = null;
    this.lastDropTargetFieldID = null;
    this.lastDragSourceElement = null;
    this.lastMouseUpElement = null;
    this.lastMouseDownElement = null;
    this.lastMouseDownFormEvent = null;
    this.lastMouseOverElement = null;
    this.dndproxy = document.getElementById("dndproxy");
    this.dndproxyValidImgSingle = document.getElementById("dndproxyValidImgSingle");
    this.dndproxyInvalidImgSingle = document.getElementById("dndproxyInvalidImgSingle");
    this.dndproxyValidImgMultiple = document.getElementById("dndproxyValidImgMultiple");
    this.dndproxyInvalidImgMultiple = document.getElementById("dndproxyInvalidImgMultiple");
    this.dndproxylabel = document.getElementById("dndproxylabel");
    this.dndproxyValidDrop = null
}
MidTierDragDropMgr.prototype.init = function() {
    this.dndproxy = document.getElementById("dndproxy");
    this.dndproxyValidImgSingle = document.getElementById("dndproxyValidImgSingle");
    this.dndproxyInvalidImgSingle = document.getElementById("dndproxyInvalidImgSingle");
    this.dndproxyValidImgMultiple = document.getElementById("dndproxyValidImgMultiple");
    this.dndproxyInvalidImgMultiple = document.getElementById("dndproxyInvalidImgMultiple");
    this.dndproxylabel = document.getElementById("dndproxylabel")
};
MidTierDragDropMgr.prototype.getLastDragSourceFieldID = function() {
    return this.lastDragSourceFieldID
};
MidTierDragDropMgr.prototype.setLastDragSourceFieldID = function(b) {
    this.lastDragSourceFieldID = b
};
MidTierDragDropMgr.prototype.setLastDropTargetFieldID = function(b) {
    this.lastDropTargetFieldID = b
};
MidTierDragDropMgr.prototype.getLastDropTargetFieldID = function() {
    return this.lastDropTargetFieldID
};
MidTierDragDropMgr.prototype.setDragSourceEnabled = function(f, b) {
    var d = this.getDragSourceHandleByNode(f);
    if (b) {
        if (d && d.isLocked()) {
            d.unlock()
        } else {
            if (!d) {
                this.registerDragSource(f);
                this.registerDropTargetRefresh(f)
            }
        }
    } else {
        if (d && !d.isLocked()) {
            d.lock()
        }
    }
};
MidTierDragDropMgr.prototype.registerDragSource = function(h) {
    var p = new MidTierDDProxy(h.id, "default_" + h.arwindowid, {
        dragElId: "dndproxy",
        resizeFrame: false,
        isTarget: false
    });
    p.removeInvalidHandleType("a");
    var b = Field_FromElement(h);
    var k = b.getNoDragDropStyleClasses();
    if (k != null) {
        var o = k.length;
        for (var g = 0; g < o; g++) {
            p.addInvalidHandleClass(k[g])
        }
    }
    var f = b.getDragHandlePrefixes();
    if (f != null) {
        var d = f.length;
        for (var g = 0; g < d; g++) {
            p.setHandleElId(f[g] + b.mID)
        }
    }
    this.dragSourceHandles["" + h.id] = p
};
MidTierDragDropMgr.prototype.getDragSourceHandleById = function(b) {
    return this.dragSourceHandles["" + b]
};
MidTierDragDropMgr.prototype.getDragSourceHandleByNode = function(b) {
    return this.getDragSourceHandleById(b.id)
};
MidTierDragDropMgr.prototype.setDropTargetEnabled = function(d, b) {
    var f = this.getDropTargetHandleByNode(d);
    if (b) {
        if (f && f.isLocked()) {
            f.unlock()
        } else {
            if (!f) {
                this.registerDropTarget(d)
            }
        }
    } else {
        if (f && !f.isLocked()) {
            f.lock()
        }
    }
};
MidTierDragDropMgr.prototype.registerDropTarget = function(b) {
    var d = new MidTierDDTarget(b.id, "default_" + b.arwindowid, {});
    this.dropTargetHandles["" + b.id] = d
};
MidTierDragDropMgr.prototype.registerDropTargetRefresh = function(b) {
    var d = this.getDropTargetHandleByNode(b);
    if (d) {
        d.initTarget(b.id, "default_" + b.arwindowid, {})
    }
};
MidTierDragDropMgr.prototype.getDropTargetHandleById = function(b) {
    return this.dropTargetHandles["" + b]
};
MidTierDragDropMgr.prototype.getDropTargetHandleByNode = function(b) {
    return this.getDropTargetHandleById(b.id)
};
MidTierDragDropMgr.prototype.createDropTargetProxy = function(d) {
    var b = d.parentNode;
    var f = document.createElement("DIV");
    f.id = "proxy" + d.id;
    f.style.top = d.offsetTop;
    f.style.left = d.offsetLeft;
    f.style.width = d.offsetWidth;
    f.style.height = d.offsetHeight;
    f.style.border = "2px solid";
    f.style.zIndex = d.style.zIndex;
    f.style.backgroundColor = "black";
    f.style.opacity = 0;
    f.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
    this.dropTargetProxies.push(f);
    b.appendChild(f)
};
MidTierDragDropMgr.prototype.removeDropTargetProxy = function(b) {
    b.parentNode.removeChild(b)
};
MidTierDragDropMgr.prototype.removeDropTargetProxies = function() {
    for (var b = 0; b < this.dropTargetProxies.length; b++) {
        this.removeDropTargetProxy(this.dropTargetProxies[b])
    }
    this.dropTargetProxies = []
};
MidTierDragDropMgr.prototype.setDragProxyValidDrop = function(d) {
    this.dndproxy.style.backgroundColor = "#E0E3F9";
    var b = getSelectedCount();
    var g = "",
    h = "";
    var f = "";
    if (b > 0) {
        if ("rl" in getDefaults_NS(MidTierDragDropMgrInst.lastDragSourceWinID)[MidTierDragDropMgrInst.lastDragSourceFieldID]) {
            g = getDefaults_NS(MidTierDragDropMgrInst.lastDragSourceWinID)[MidTierDragDropMgrInst.lastDragSourceFieldID].rl
        }
        if ("rlp" in getDefaults_NS(MidTierDragDropMgrInst.lastDragSourceWinID)[MidTierDragDropMgrInst.lastDragSourceFieldID]) {
            h = getDefaults_NS(MidTierDragDropMgrInst.lastDragSourceWinID)[MidTierDragDropMgrInst.lastDragSourceFieldID].rlp
        }
        if (b == 1) {
            f = "  " + (g.length > 0 ? ("  " + g.replaceArgs(b)) : g)
        } else {
            f = "  " + (h.length > 0 ? ("  " + h.replaceArgs(b)) : h)
        }
    }
    if (!d) {
        if (b > 1) {
            this.dndproxyInvalidImgMultiple.style.display = "";
            this.dndproxyInvalidImgSingle.style.display = "none";
            this.dndproxyValidImgMultiple.style.display = "none";
            this.dndproxyValidImgSingle.style.display = "none"
        } else {
            this.dndproxyInvalidImgMultiple.style.display = "none";
            this.dndproxyInvalidImgSingle.style.display = "";
            this.dndproxyValidImgMultiple.style.display = "none";
            this.dndproxyValidImgSingle.style.display = "none"
        }
    } else {
        if (b > 1) {
            this.dndproxyInvalidImgMultiple.style.display = "none";
            this.dndproxyInvalidImgSingle.style.display = "none";
            this.dndproxyValidImgMultiple.style.display = "";
            this.dndproxyValidImgSingle.style.display = "none"
        } else {
            this.dndproxyInvalidImgMultiple.style.display = "none";
            this.dndproxyInvalidImgSingle.style.display = "none";
            this.dndproxyValidImgMultiple.style.display = "none";
            this.dndproxyValidImgSingle.style.display = ""
        }
    }
    this.dndproxyValidDrop = d;
    this.dndproxylabel.innerHTML = f
};
var MidTierDragDropMgrInst = new MidTierDragDropMgr();
function DragField_Init(d) {
    var g = getFormDataHolderById(d).dragFields;
    for (var f = 0; f < g.length; f++) {
        var b = g[f];
        var k = getFields_NS(d)[b];
        var h = k.mObj;
        if (k.GAccess() != 3) {
            MidTierDragDropMgrInst.registerDragSource(h)
        }
    }
}
function DropField_Init(b) {
    var d = getFormDataHolderById(b).dropFields;
    for (var f = 0; f < d.length; f++) {
        var k = d[f];
        var h = getFields_NS(b)[k];
        var g = h.mObj;
        if (h.GAccess() != 3) {
            MidTierDragDropMgrInst.registerDropTarget(g)
        }
    }
}
function getSelectedCount() {
    var h = MidTierDragDropMgrInst.lastDragSourceFieldID;
    if (h == null || h == "undefined" || h.length == 0) {
        return ""
    }
    var b = F(MidTierDragDropMgrInst.lastDragSourceWinID, h);
    var f = b.mRowSelections;
    var g = 0;
    for (var d in f) {
        g++
    }
    return g
}
function MenuBoxPopup(f, g, k, b, h) {
    var o = "";
    if (k.length > 0) {
        o = getLocalizedMessage("Menu for {0}", [k])
    } else {
        o = getLocalizedMessage("Menu")
    }
    if (typeof(AbsContextPath) == "undefined") {
        AbsContextPath = "../../"
    }
    var d = weOpenModalPopup(f, (AbsContextPath + "resources/html/MenuBoxPopup.html"), "Editor", {
        title: o,
        arg: b,
        appss: GetAppStyleSheet("../../")
    },
    h, [640, 480]);
    return d
}
var MenuPopupList = new Array();